Ensure a form stays in the background #189
The following code ensures that a form always stays in the background, even when it has focus. It is done by making the form a child of the Windows desktop.
First place the following method declaration in your form's protected section:
protected ... procedure CreateParams(var Params: TCreateParams); override;</div> ...
and implement the method as follows:
procedure TForm.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); if Assigned(Application.MainForm) then begin Params.WndParent := GetDesktopWindow; Params.Style := WS_CHILD; end; end;
|Contributor:||Riccardo Faiella (Topellina)|