在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1 HMODULE GetSelfModuleHandle() 2 { 3 MEMORY_BASIC_INFORMATION mbi; 4 return ((::VirtualQuery(GetSelfModuleHandle, &mbi, sizeof(mbi)) != 0) ? (HMODULE)mbi.AllocationBase : NULL); 5 } 6 7 CString GetCurrentPath(void) 8 { 9 TCHAR path[MAX_PATH] = {0}; 10 memset(path, 0, sizeof(path)); 11 GetModuleFileName(GetSelfModuleHandle(),path,sizeof(path)); 12 int l = _tcslen(path); 13 TCHAR ch = 0; 14 while ('\\' != (ch = *(path + --l))); 15 *(path + l + 1) = 0; 16 return CString(path); 17 }
注意,GetSelfModuleHandle函数必须是全局的,或者类的静态成员方法。
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论