Calling MC++ methods in C# application

  • Thread starter Thread starter QINGFENG
  • Start date Start date
Q

QINGFENG

Hi,

I am writing a Managed C++ wrapper DLL for some C
functions in a statically linked library, such that I can
use those C functions (through the C++.NET Wrapped
mehtods) in a C# Windows User Control.

The C function is: someFunction(HINSTANCE hinst); // the
parameter is HINSTANCE.

How can I write a correct wrapper function in MC++ for the
above function? In another word, What can I pass in as a
HINSTANCE? Note that this MC++ method will be called in C#
program.

Thanks
 
QINGFENG said:
Hi,

I am writing a Managed C++ wrapper DLL for some C
functions in a statically linked library, such that I can
use those C functions (through the C++.NET Wrapped
mehtods) in a C# Windows User Control.

The C function is: someFunction(HINSTANCE hinst); // the
parameter is HINSTANCE.

How can I write a correct wrapper function in MC++ for the
above function? In another word, What can I pass in as a
HINSTANCE? Note that this MC++ method will be called in C#
program.

Thanks

Perhaps Marshal.GetHINSTANCE.
 
DM McGowan II said:
Perhaps Marshal.GetHINSTANCE.

So is that what you were looking for or are you just one of those new
generation types that asks for help but doesn't know how to be gracious and
tell someone yes that worked or no that wasn't it?
 
You are right. I should have replied back with some points. Actually, I
did not try the proposed method. Just in my case, I passed a
System.IntPtr(0) and it worked fine.
 
Back
Top