what is HInstance?

  • Thread starter Thread starter Frank Lee
  • Start date Start date
F

Frank Lee

Bitmap has a method named FromResource, which has two params, one is
HInstance intptr, the other is resourcename. I don't understand what
HInstance is. How to get it?


Thanks


---Frank
 
hInstance is from the basic windows API. FromResource requires a file handle to a resource dll.

You can get a file handle using CreateFile from Kernel32.dll. And you need to use pInvoke to be able to use CreateFile.

A HINSTANCE isn't the same as a file handle. You get a module's
HINSTANCE from APIs like LoadLibrary[Ex] and GetModuleHandle[Ex].



Mattias
 
Sorry about that, the help description of Bitmap.FromResource had me confused :/

hinstance -> A handle to an instance of the executable file that contains the resource.


hInstance is from the basic windows API. FromResource requires a file handle to a resource dll.

You can get a file handle using CreateFile from Kernel32.dll. And you need to use pInvoke to be able to use CreateFile.

A HINSTANCE isn't the same as a file handle. You get a module's
HINSTANCE from APIs like LoadLibrary[Ex] and GetModuleHandle[Ex].



Mattias
 
Back
Top