OpenNETCF Smart Device Framework 2.3
Provides an interface to expose Win32 HWND handles.

Namespace:  OpenNETCF.Windows.Forms
Assembly:  OpenNETCF.Windows.Forms (in OpenNETCF.Windows.Forms.dll) Version: 2.3.0.0

Syntax

C#
public interface IWin32Window
Visual Basic (Declaration)
Public Interface IWin32Window
Visual Basic (Usage)
Dim instance As IWin32Window
Visual C++
public interface class IWin32Window
J#
public interface IWin32Window
JScript
public interface IWin32Window
JavaScript
OpenNETCF.Windows.Forms.IWin32Window = function();
OpenNETCF.Windows.Forms.IWin32Window.createInterface('OpenNETCF.Windows.Forms.IWin32Window');

Remarks

This interface is implemented on objects that expose Win32 HWND handles. The resultant handle can be used with Win32 API calls.

Unlike the desktop .NET Framework this interface is not implemented in the base Control class. However you can implement it on any class which derives from Control or Form. The Handle property can then be passed to native API functions such as those contained in the Win32Window class.

Examples

CopyC#
[VB]
Imports OpenNETCF.Windows.Forms
Imports OpenNETCF.Win32

Public Class MyControl
       Inherits System.Windows.Forms.Control
       Implements IWin32Window

       Overridable ReadOnly Property Handle() As System.IntPtr
           Get
               Me.Capture = True
               Dim thishandle As IntPtr
               thishandle = Win32Window.GetCapture()
               Me.Capture = False

               Handle = thishandle
           End Get
       End Property

End Class
CopyC#
[C#]
using OpenNETCF.Windows.Forms;
using OpenNETCF.Win32;

public class MyControl : Control, IWin32Window
{

       public IntPtr Handle
       {
           get
           {
               this.Capture = true;
               IntPtr thishandle = Win32Window.GetCapture();
               this.Capture = false;

               return thishandle;
           }
       }
}

See Also