Vcl.Forms.TApplication.HookMainWindow
Delphi
procedure HookMainWindow(Hook: TWindowHook);
C++
void __fastcall HookMainWindow(TWindowHook Hook);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | Vcl.Forms.pas Vcl.Forms.hpp |
Vcl.Forms | TApplication |
Description
Enables a native Windows dialog box to receive messages sent to the application's main window.
Use HookMainWindow to ensure that a native Windows dialog box behaves correctly as a child of the application, not as a stand-alone window. For example, switching among applications with Alt+Tab treats the application as a single task after calling HookMainWindow, rather than treating the native Windows dialog box as a separate task.
When the window identified by the Handle property receives relevant dialog messages, it passes them to the dialog procedure passed as the Hook parameter.
There is no problem with leaving a dialog box hooked into the main window, even for extended periods. However, should the dialog box close, call the UnhookMainWindow method to release the hook.