実行ファイル(自分自身)のパスを取得する
【サンプル】
//実行ファイル名(自分自身)のパスを取得する
void CGetExeFilePathDlg::OnButton1()
{
//自分自身のアプリケーション名を取得
CString ExeFName = AfxGetAppName();
//モジュール・ハンドルを取得する
HMODULE hMdl = GetModuleHandle(ExeFName + ".exe");
//実行ファイル名をフルパスで取得
char strFilePath[_MAX_PATH];
DWORD Ret = GetModuleFileName(hMdl, strFilePath, _MAX_PATH);
if(Ret != 0) AfxMessageBox(strFilePath);
}
[サンプル・ソース]