"Dave" <NO*********@dotcomdatasolutions.com> wrote in
news:uF**************@TK2MSFTNGP09.phx.gbl:
int myint = MainWindow.hWnd; // assuming hWnd returns a
System.Int32.
IntPtr NativeRuntimeHandle = new IntPtr(myint);
OK I think we are going in the wrong direction. Here's the documentation
I dug up.
Win32 info since the DLL is a Win32 DLL...
HWND - Handle to a window
Usage example:
BOOL ShowWindow( HWND hWnd, int nCmdShow );
Drilling down a bit it appears that HWND is just an unsigned integer, not
some structure or anything.
OK now for the .NET application that is trying to use the DLL.
I created a form and put a button on it.
In the form create, I load the DLL and resolve the function references.
The button on click tries to call the function from the DLL.
The form, basically a default form:
public __gc class Form1 : public System::Windows::Forms::Form
has a property "Handle" the help text says:
[C++]
public: __property virtual IntPtr get_Handle();
Property Value
An IntPtr that contains the window handle (HWND) of the control.
Implements
IWin32Window.Handle
Remarks
The value of the Handle property is a Windows HWND. If the handle has
not yet been created, referencing this property will force the handle to
be created.
Finally, I have tried everything I can think of to get the compiler to
accept/convert the .NET form handle to a HWND. It's got me stumped.