Passing HWND for C++ wrapper

C

Chris Ashley

I am writing a Managed C++ wrapper for some unmanaged code to be used
from C#. A lot of the C++ methods expect HWND parameters - what is the
best way of passing these from C#? At the moment I am taking an IntPtr
in my wrapped methods and casting to HWND from the IntPtr.ToPointer()
method - is this the best approach?

Thanks
 
C

Carl Daniel [VC++ MVP]

Chris said:
I am writing a Managed C++ wrapper for some unmanaged code to be used
from C#. A lot of the C++ methods expect HWND parameters - what is the
best way of passing these from C#? At the moment I am taking an IntPtr
in my wrapped methods and casting to HWND from the IntPtr.ToPointer()
method - is this the best approach?

AFIAK, that's pretty much the standard solution.

-cd
 

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