Export (0) Print
Expand All

IWin32Window Interface

Provides an interface to expose Win32 HWND handles.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

[GuidAttribute("458AB8A2-A1EA-4d7b-8EBE-DEE5D3D9442C")] 
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] 
[ComVisibleAttribute(true)] 
public interface IWin32Window
/** @attribute GuidAttribute("458AB8A2-A1EA-4d7b-8EBE-DEE5D3D9442C") */ 
/** @attribute InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown) */ 
/** @attribute ComVisibleAttribute(true) */ 
public interface IWin32Window
GuidAttribute("458AB8A2-A1EA-4d7b-8EBE-DEE5D3D9442C") 
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown) 
ComVisibleAttribute(true) 
public interface IWin32Window

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

The following example sets the Text property of label1 to the current Handle of Form1. This example assumes that you have a Form called Form1 with a Label called label1 on it.

public Form1()
{
   InitializeComponent();

   this.label1.Text = this.Handle.ToString();
}


public Form1()
{
    InitializeComponent();
    this.label1.set_Text(this.get_Handle().ToString());
} //Form1

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft