HINSTANCE

  • Thread starter Thread starter mphanke
  • Start date Start date
M

mphanke

Hi,

how do I get the HINSTANCE for an .NET application?
ExtractAssociatedIcon always complains about an missing pointer reference...

Regards,

Martin
 
mphanke,

I am curious, why not use SHGetFile info? It will get the icon
associated with a file, and take into account shell handlers and the like
(unlike ExtractAssociatedIcon). Also, you don't need an application handle.

If you still want to get the HINSTANCE, then you will have to get a
module from the application (through a call to the GetModule or GetModules
method on the Assembly class) and pass that to the static GetHINSTANCE
method on the Marshal class.

Hope this helps.
 
Hi,

I tried your way - the problem was the file was on a Server and this
didn't work, as long as the file is stored locally there is no problem.
Look at the "Retrieve File Icon from Registry"-thread, I posted some source.

Thanks for your hint though this really helped me!
Regards,

Martin
 
Back
Top