I just made a small app here in Delphi 7 that simulates the default system icons, like Volume, Battery, Clock, Network.
I'm trying to follow all Microsoft recomendations here http://msdn.microsoft.com/en-us/library/aa511448.aspx#flyouts
To make a window look like a flyout, i'm using this code:
//declaration
TForm1 = class(TForm)
protected
procedure CreateParams(var Params: TCreateParams); override;
end;
implementation
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.Style := WS_POPUP or WS_THICKFRAME;
Params.ExStyle := Params.ExStyle or WS_EX_TOPMOST;
end;
My problem is the WS_THICKFRAME allows user to resize the window. How can I fix this?
You can prevent resizing by handling WM_GETMINMAXINFO.
However, this won't prevent the resize cursor from being used. For that, you can handle WM_NCHITTEST
.
Just handle the WM_NCHITTEST
message and always return HTCLIENT
value.
Which will mean for OS that it is over the client area of the app. It will not then show the resize cursor.
I'm using this approach in WPF app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With