Handle of Form needed

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

Peter Foot [MVP]

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
 

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