This documentation is archived and is not being maintained.

IWin32Window.Handle Property

Gets the handle to the window represented by the implementer.

[Visual Basic]
ReadOnly Property Handle As IntPtr
[C#]
IntPtr Handle {get;}
[C++]
__property IntPtr get_Handle();
[JScript]
function get Handle() : IntPtr;

Property Value

A handle to the window represented by the implementer.

Remarks

Depending on the implementer, the value of the Handle property could change during the life of the window.

Example

[Visual Basic, C#, C++] 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.

[Visual Basic] 
Public Sub New()
    InitializeComponent()
    
    Me.label1.Text = Me.Handle.ToString()
End Sub    


[C#] 
public Form1()
{
   InitializeComponent();

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


[C++] 
public:
 Form1()
 {
    InitializeComponent();
 
    this->label1->Text = this->Handle.ToString();
 }
 

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

IWin32Window Interface | IWin32Window Members | System.Windows.Forms Namespace

Show: