procedure ShowParentForm; // brings form to front and restores it if it was minimized

property Parent: TWinControl;

property ParentForm: TForm; // nil if parent is not form

property ParentHandle: THandle; // read-only

property SystemMenuHandle: hMenu; // read-only

property OldWndProc: Pointer; // read-only

property WindowStyle: LongInt;

property WindowExStyle: LongInt;

property Topmost: Boolean;

property TopmostDesign: Boolean; // read-only

end;

Description

The TacFormHookComponent class hooks all Windows messages (WM_xxx) that passes to the Delphi/BCB forms and let you process these messages by hooking MessageBefore and MessageAfter protected routines. By hooking the FormRecreate procedure  you can be notified after recreationg of the form's window handle.

Protected Methods

MessageBefore

Hooks all windows messages, before they will passed to default message handler. If you have processed this message and do not want to pass it to default message handler, set Handled parameter True. See also OnMessageBefore event of TacFormHook component.

MessageAfter

Hooks windows message after their processed by default message handler. See also OnMessageAfter event of TacFormHook component.

FormRecreate

The FormRecreate routine hooks the recreation of form's window handle (for example, after changing of the BorderStyle or FormStyle property values). Modify the FormRecreate handler to restore necessary form styles and hooks after recreation of your form. See also OnFormRecreate event of TacFormHook component.

GetParentHandle

Function returns the window handle of the owner form (or owner control). Usually it returns window handle of owner control, however, if the owner is a form with FormStyle = fsMDIForm, it returns client handle (handle of client area).

GetSysemMenuHandle

Returns handle of the system menu of the owner form, or NULL if the owner is not a form.

Returns and changes the pointer to the owner form or owner control. At once after changing the parent, component will hook messages of another, specified control. Please change this property with caution, because some successors of TacFormHookComponent could not work without form;

ParentForm

Returns and changes the pointer to the owner form. Returns NULL if the owner is not a form;

ParentHandle

Read-only property. Returns same value as GetParentHandle routine in "protected" section. Note that Parent of TacFormHookComponent must be always TWinControl or its successor (see TacComponent);

SystemMenuHandle

Read-only. Returns same as GetSystemMenuHandle routine in "protected" section;

OldWndProc

Pointer to the previous, hooked message handler;

WindowStyle

Determines and / or changes a window style (same as GetWindowLong(Handle, GWL_STYLE));

WindowExStyle

Determines and / or changes an extended window style (same as GetWindowLong(Handle, GWL_EXSTYLE)).