|
BOOL GetArxPath(CString &path)
{
CString ArxPath;
ACHAR modulePath[512];//取应用程序路径
//CString FileName = acedGetAppName(); //功能与下个函数重复,可能为空,不可靠
HMODULE hModule = NULL;
MEMORY_BASIC_INFORMATION mbi;
if(::VirtualQuery(GetArxPath, &mbi, sizeof(mbi)) != 0)
{
hModule = (HMODULE) mbi.AllocationBase;
}
DWORD pathLength = GetModuleFileName(hModule, modulePath, 512);
if (pathLength)
{
ArxPath=modulePath;
int rs=ArxPath.ReverseFind('//'); //查找最后一个'//'的位置
path = ArxPath.Left(rs); //去掉文件名
return TRUE;
}
return FALSE;
} |
|