winapi – 如何从DLL获取HINSTANCE?

前端之家收集整理的这篇文章主要介绍了winapi – 如何从DLL获取HINSTANCE?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在VC中创建了一个DLL作为Win32项目

DLLMAIN函数

BOOL APIENTRY DllMain( HMODULE hModule,DWORD  ul_reason_for_call,LPVOID lpReserved
                     )
{
    return TRUE;
}

现在我需要HINSTANCE的DLL,需要传递给Win32函数.

HMODULE和HINSTANCE是否相同?

如何获得HINSTANCE?

本书摘自Windows Via C/C++ [1]

Note As it turns out,HMODULEs and HINSTANCEs are exactly the same thing. If the documentation for a function indicates that an HMODULE is required,you can pass an HINSTANCE and vice versa. There are two data types because in 16-bit Windows HMODULEs and HINSTANCEs identified different things

[1] Richter,Jeffery和Nasarre,Christophe,Windows Via C/C++,5th ed,Redmond:Microsoft Press 2008,pp.74

原文链接:https://www.f2er.com/windows/371257.html

猜你在找的Windows相关文章