RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TWinControl.Handle Property

Provides access to the underlying Windows screen object for the control.

Pascal
property Handle: HWnd;
C++
__property HWnd Handle;

The Handle property returns the window handle for the underlying Microsoft Windows screen object. Use the Handle property to bypass the VCL API and directly access the underlying window. 

Do not refer to the Handle property during component creation or streaming. The underlying window does not exist until the first time the Handle property is referenced. When this occurs, the HandleNeeded method is called automatically. 

Handle is a read-only property.  

C++ Examples: 

 

/*
The following code uses the Windows API function ShowWindow
to display Form2 as an icon, but does not activate it.
*/

#include "Unit2.h"

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  ShowWindow(Form2->Handle, SW_SHOWMINNOACTIVE);
}

 

Delphi Examples: 

{
The following code uses the Windows API function ShowWindow
to display Form2 as an icon, but does not activate it.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowWindow(Form2.Handle, SW_SHOWMINNOACTIVE);
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!