Modeless children's window that allows you to get the main form - Delphi

In Delphi (2009 Pro) - I have a basic form that can create modeless child windows. I want some shape to focus on the top - even if it's the main window that has focus.

+3
source share
2 answers

Since Delphi 2007/2009, VCL has changed its behavior regarding the parent of the form. In Delphi 1-2006, the parent of the form was a hidden application window (Application.Handle). In Delphi 2007/2009, the parent of the form is the main form, and the main parent of the form is the desktop.

, *.dpr Application.MainFormOnTaskbar False, , Vista Windows 7. CreateParams Params.WndParent (HWND_DESKTOP) Application.Handle.

type
  TMyChildForm = class(TForm)
  protected
    procedure CreateParams(var Params: TCreateParams); override;
  end;

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  Params.WndParent := Application.Handle;
end;
+7

. , , , , . Form FormStyle fsStayOnTop?

0

Source: https://habr.com/ru/post/1709713/


All Articles