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

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
 
C

ClayB

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top