Calling MC++ methods in C# application

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
 
D

DM McGowan II

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.
 
D

DM McGowan II

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?
 
D

DUAN

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.
 

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