The main form of the Delphi application: temporarily moving forward

We have a Delphi 2007 application and recently included MainFormOnTaskBar for better support for Windows Aero. However, due to the fact that the main form did not fall at the top of all child forms when clicked, we added the following code.

procedure TBaseForm.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);

  Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
  Params.WndParent := 0; 
end;

One of the side effects is that when you press the Alt+ hotkey keyon a child form that does not handle this special hotkey, the main form moves forward and then back. If a hotkey is being processed, this behavior does not occur, probably because the hotkey is swallowed.

Has anyone else experienced this behavior and might recommend a workaround.

thank

+4
1

VCL , , .

SetFocus , "" CM_APPSYSCOMMAND, WM_SYSCOMMAND "WinControl" ( ), SC_KEYMENU ( - Alt).

, MainFormOnTaskBar, CreateParams, , . MainFormOnTaskBar. , , , .

, , , WM_SYSKEYDOWN OnKeyDown . , , IsShortCut . , , . VCL, :

type
  TSecondaryForm = class(TForm)
    ..
  public
    function IsShortCut(var Message: TWMKey): Boolean; override;

...

function TSecondaryForm.IsShortCut(var Message: TWMKey): Boolean;
begin
  Result := True;
end;

, , true .

+5

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


All Articles