天天看点

BCB如何获取.exe所在的路径?

       直接上代码:

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    // .exe的路径
    ShowMessage(ExtractFilePath(Application->ExeName));
}
//---------------------------------------------------------------------------
           

       貌似在VC++中没有这么方便。

继续阅读