Stephen Ellis
Stephen Ellis

Reputation: 2701

Converting System::IntPtr to HINSTANCE

I'm grabbing the HINSTANCE of a c# form using:

IntPtr hinstance = Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]);

I'm then trying to pass it on to a C++/CLI component. I'm pretty sure this is a dumb question, but how in C++ CLI do you convert from an IntPtr to an HINSTANCE?

Upvotes: 1

Views: 1432

Answers (1)

user180326
user180326

Reputation:

Call ToPointer() on it, you'll get a void*. That should be assignable to an HINSTANCE.

Upvotes: 3

Related Questions