Click to See Complete Forum and Search --> : hinstance


Kanker Noob
July 28th, 2005, 08:23 PM
hinstance is passed in winmain is it important to use it at createwindow?

SuperKoko
July 29th, 2005, 11:24 AM
It is important if you have created some non-shared custom classes (that is, custom classes with WNDCLASS::hInstance not set to NULL).
With MFC or other windows API wrappers, you probably need it.

this system has the advantage that more than one module (.dll or .exe) running in the same process, may have a window class with the same name, without conflict.
Follow this link:
http://blogs.msdn.com/oldnewthing/archive/2005/04/18/409205.aspx
The Old New Thing explains well why you need to pass the HINSTANCE to CreateWindow.

NoHero
July 29th, 2005, 03:06 PM
And you need it for every resource operation. E.g. for loading an icon from your EXE's/DLL's resource section.