char szFileName[512];
GetModuleFileName(NULL,szFileName,512);
参数为NULL时,得到的是当前进程的目录
GetModuleFileName(NULL,szFileName,512);
参数为NULL时,得到的是当前进程的目录
解决方案 »
- VC++运用MSXML生成XML文件时如何添加注释
- VC實現虛擬打印機編程,做過的朋友給點建議?有好的庫,還是用DDK
- 请教有关VC与MATLAB的混合编程进行图像处理
- 关于完成端口一个小问题
- 300分求一问题解决或思路,解决后另开贴送分!!!
- 简单!!!!!怎么判断这个记录集没有做修改.
- 问一个关于setsystemtime函数。
- 如何检测哪一个线程霸占了CPU?
- 在CHTMLView中,如何得到ICustomDoc接口,并设置IDocHostUIHandler接口?
- 求助
- 好久不上这了!来给大家免费送分!!
- 那位帅哥晓得,html help 的chm中怎么在程序中调用?map alias .....的设置?
GetCurrentDirectory(...) 得到的是当前目录,是不行的
CString strPath;GetModualFileName(NULL,cPath,MAX_PATH);
strPath = cPath;
strPath = strPath.Left(strPath.ReverseFind('\\'));
AfxMessageBox(strPath); // strPath为你想得到的EXE文件路径
HMODULE hModule, // handle to module
LPTSTR lpFilename, // file name of module
DWORD nSize // size of buffer
);
Parameters
hModule
[in] Handle to the module whose file name is being requested. If this parameter is NULL, GetModuleFileName returns the path for the file containing the current process.
lpFilename
[out] Pointer to a buffer that receives the path and file name of the specified module.
nSize
[in] Specifies the length, in TCHARs, of the lpFilename buffer. If the length of the path and file name exceeds this limit, the string is truncated
GetModuleFileName函数是可以的。如果不是的话,你的意思是说?