How do I get a HINSTANCE into my C++ class library from my C# code?

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

I'm writing a little helper class in C++ for my C# project to do some
things that aren't available in frameworks (like managing the
clipboard chain).

In order to create a proxy window to catch things like
WM_SETCLIPBOARD, I have to register a window class and create a
window, and so on.

All of this requires a HINSTANCE, but I don't know how to get one from
my class library or, as I would prefer, to pass one into the helper
class from my C# code.

Can anyone tell me how its done?

Thanks!
-Dave
 
You might try looking at the Marshal.GetHINSTANCE method to see if
that does what you need.

IntPtr hInst =
System.Runtime.InteropServices.Marshal.GetHINSTANCE(this.GetType().Mo­
d
ule );

=========
Clay Burch
Syncfusion, Inc.
 
Back
Top