#pragma once
#if _MSC_VER >= 1300 // for VC 7.0
// from ATL 7.0 sources
#ifndef _delayimp_h
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
#endif
#include <string>
static HMODULE GetCurrentModule()
{
#if _MSC_VER < 1300 // earlier than .NET compiler (VC 6.0)
// Here's a trick that will get you the handle of the module
// you're running in without any a-priori knowledge:
MEMORY_BASIC_INFORMATION mbi;
static int dummy;
VirtualQuery( &dummy, &mbi, sizeof(mbi) );
return reinterpret_cast<HMODULE>(mbi.AllocationBase);
#else // VC 7.0
// from ATL 7.0 sources
return reinterpret_cast<HMODULE>(&__ImageBase);
#endif
}
//完整路径
std::string GetDllFileFullPath()
{
char temp[MAX_PATH] = {0};
::GetModuleFileNameA( GetCurrentModule(), temp, MAX_PATH );
return std::string(temp);
}
获取加载的dll文件路径
最新推荐文章于 2021-05-21 05:47:12 发布