欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

NX 获取运行dll文件的全名

程序员文章站 2022-06-26 08:02:42
...
//NX 获取运行dll文件的全名
HMODULE GetSelfModuleHandle()
{
	MEMORY_BASIC_INFORMATION mbi;
	return ((::VirtualQuery(GetSelfModuleHandle, &mbi, sizeof(mbi)) != 0) ? (HMODULE)mbi.AllocationBase : NULL);
}


extern CString GetCurrentPath(void)
{
	TCHAR path[MAX_PATH] = {0};
	memset(path, 0, sizeof(path));
	GetModuleFileName(GetSelfModuleHandle(),path,sizeof(path));
	int l = _tcslen(path);
	char driveA[1024] = {0};
	char drive[_MAX_DRIVE] = {0};
	char dir[_MAX_DIR] = {0};
	char fname[_MAX_FNAME] = {0};
	char ext[_MAX_EXT] = {0};
	int length = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL);
	WideCharToMultiByte(CP_ACP, 0, path, -1, driveA, length, NULL, NULL);
	_splitpath(driveA,drive ,dir ,fname ,ext);
	string str = fname;
	str = str + ".dll";
	return CString(str.c_str());
}