What is TApplication.Handle?
- Where does it come from?
- Why does it exist?
- And most importantly: why do all forms have it as their parent window handle?
The Delphi help says:
TApplication.Handle
Provides access to the window handle of the main form (window) of the application.
property Handle: HWND;Description
Use Handle when calling Windows API functions that require a parent window handle. For example, a DLL that displays its own top-level pop-up windows needs a parent window to display its windows in the application. Using the Handle property makes such windows part of the application, so that they are minimized, restored, enabled and disabled with the application.
If I focus on the words "the window handle of the main form of the application", and I take that to mean the window handle of the main form of the application, then I can compare:
- "the window handle of the main form of the application", with
- the window handle of the
MainFormof theApplication
but they are not the same:
Application.MainForm.Handle: 11473728
Application.Handle: 11079574
So what is Application.Handle?
- Where does it come from?
- What Windows® window handle is it?
- If it is the Windows® window handle of the
Application'sMainForm, then why don't they match? - If it's not the window handle of the
Application'sMainForm, then what is it? - More importantly: Why is it the ultimate
parentowner of every form? - And most important: Why does everything go haywire if i try to have a form be
unparentedunowned (