System menu for layered windows?

We have a problem with multi-level windows and system menus in Delphi 2009. That is, our layered windows (without borders) do not have a system menu. When I talk about the system menu, I mean the menu that you get when you click on the application icon, right-clicking its title or (in Windows 7 with the shift key), right-clicking the application on the taskbar

Control menus

When trying to access the system menu, for example. by right-clicking on the taskbar icon of such a multi-level window, the multi-level window will increase instead. Why is this? Is there some kind of style to set up or some kind of event to handle?

Here's a quick demo showing the problem. However, it can be played with any form using bsNone borderstyle.

http://ompldr.org/vODd5dw

+4
source share
1 answer

You need to add the WS_SYSMENU style, which will be removed using the bsNone style.

 type TLayeredForm = class(TForm) procedure FormCreate(Sender: TObject); protected procedure CreateParams(var Params: TCreateParams); override; end; ... procedure TLayeredForm.CreateParams(var Params: TCreateParams); begin inherited; Params.Style := Params.Style or WS_SYSMENU; end; 
+13
source

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


All Articles