I am trying to call the PrintDlgW Win32 API from C# via P/Invoke. With the help of P/Invoke Interop Assistant 1.0 from Microsoft, I am able to declare necessary data structures and import functions from DLL. But how to use the HDC or HWND in C#? Thanks in advance.
+2
A:
HWND in C++ is really a void *, which is represented in C# by the IntPtr type.
Otávio Décio
2010-02-17 13:50:56
+1
A:
It might make it easier to do this
using HWND = System.IntPtr;
Then use HWND in your pInvoke...to make it easier to read and keep it "the same" as the pinvoke signature.
Hope this helps, Best regards, Tom.
tommieb75
2010-02-17 13:54:40
You can do this if you like your C# to look like C++. Personally, I would avoid that.
Bryan
2010-02-17 14:20:57
+2
A:
This site has nice examples with structures already defined for quite a few APIs. The structure is here.
Mark Wilkins
2010-02-17 13:54:46