Vcl.Controls.TWinControl.Handle

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Handle: HWND read GetHandle;

C++

__property HWND Handle = {read=GetHandle, nodefault};

Properties

Type Visibility Source Unit Parent
property public
Vcl.Controls.pas
Vcl.Controls.hpp
Vcl.Controls TWinControl

Description

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

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.

Note: On Win64, the size of HANDLE types has changed to 64-bits --except for OLE_HANDLE, which is now a 32bit Long even in Win64. This means that you need to change any code that assumed OLE_HANDLE and other HANDLE types are interchangeable. See also http://stackoverflow.com/questions/401812/what-is-the-proper-way-to-cast-from-an-ole-handle-to-an-hicon.

See Also

Code Examples