Handle of Form needed

  • Thread starter Thread starter Semion
  • Start date Start date
S

Semion

Hello everybody!

I have some problems with Compact Framework ( WinCE 4 ).
I have wonderful dll, written on Embedded VC++, and I need now
to use it on C#.
My problem is that the first initialization function in the dll
needs pointer to CWnd. The function creates child window for this
pointer and dll works fine.
In the desktop version of C# I create main form and pass to dll
the "Handle" of this form. Through the handle I can get all the
information I need. But on Compact Framework the "Handle"
property is not supported, VC++ is is not supported too, so I
can't recompile the dll as .Net version.
May be somebody knows, how can I get something like window
"Handle" in the C# Compact Framework ???

Thanks.
 
You can do it by P/Invoking an API function. You have two possible options:-
Set the focus to the form and then use the GetFocus() API call to retrieve
the hWnd. Alternatively set the Capture on the form and use GetCapture. Both
of these functions are simple to implement with P/Invoke and are also
included in the WinAPI library - www.opennetcf.org/WinAPI.asp

Peter
 
Back
Top