Archived

This topic is now archived and is closed to further replies.

Floating

How to retrieve a pointer to the current WinApp??

Recommended Posts

Floating    122
Hi, I have a console application calling a dll. In that dll I would like to retrieve a pointer to the current WinApp so that I can set the icon of my window with LoadIcon (the window is launched in the dll). How can I do this? Thanks

Share this post


Link to post
Share on other sites
LessBread    1415
GetModuleHandle(NULL)

"If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process."

The return value will be the same as what you would have from the HINSTANCE passed to WinMain.

If the icon is stored in the dll - pass the name of the dll file to GetModuleHandle - the return value will be the same as the HINSTANCE value passed into DllMain.

Also note that HINSTANCE == HMODULE (they''re both void pointers)

Share this post


Link to post
Share on other sites