2010. január 3., vasárnap

Show a secondary form without the main form


Problem/Question/Abstract:

How do I make it so that only the form I select comes to the top (i.e. without the main form)?

Answer:

Try this in any secondary window that you don't want dragging the program along:

{ ... }
private
{ Private declarations }

procedure CreateParams(var Params: TCreateParams); override;
{ ... }

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  Params.WndParent := GetDesktopWindow;
end;

By setting the form's parent window handle to the desktop, you remove the link that would normally force the whole application to come to the top when this form comes to the top.

Nincsenek megjegyzések:

Megjegyzés küldése