如何的确定调用的dll所在的路径
2007-12-11 16:26
344 查看
#if _MSC_VER >= 1300 // for VC 7.0
// from ATL 7.0 sources
#ifndef _delayimp_h
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
#endif
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:
// http://www.dotnet247.com/247reference/msgs/13/65259.aspx
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
}
// from ATL 7.0 sources
#ifndef _delayimp_h
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
#endif
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:
// http://www.dotnet247.com/247reference/msgs/13/65259.aspx
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
}
相关文章推荐
- 如何获取dll文件所在路径?
- 在DLL中如何确定自身的文件路径
- ungui web应用在 ISAPI modules模式下如何获取DLL所在的路径?
- UIWebView中链接调用Safari打开目标链接 点击cell里面的一个按钮如何确定按钮所在的cell的行
- 如何在编译器(vs2008)里设置调用别人写好的lib和dll
- 如何寻找已注册dll的路径
- 40、C#:如何调用外部dll的接口
- DLL嵌套调用的搜索路径
- 如何把.js文件编译成dll供页面调用[转]
- 如何把.js文件编译成dll供页面调用
- 实在受不了了,大家来帮帮我如何调用这个C++/CLI的DLL
- C#中如何调用C++编写的DLL
- Dll中调用WebService,如何使用Web.config中配置的WebService的Url
- 如何把.js文件编译成dll供页面调用?
- 将C语言编译成DLL并用C#进行调用以及关于从C#传输中文路径到C的DLL中打开文件的问题
- VC中如何调用DLL中的函数
- 如何调用DLL (基于Visual C++6.0的DLL编程实现)
- C#中如何调用动态链接库DLL(转)
- 实例描述如何用python组件ctypes调用c的dll中的函数
- 配置类库dll所在的目录下的相对路径