Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a window like Windows 7 Notifications Flyouts, (WS_THICKFRAME but NOT-RESIZABLE)

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?

Resizable Window Issue

like image 575
Vitim.us Avatar asked Sep 13 '11 21:09

Vitim.us


2 Answers

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.

like image 145
Ben Voigt Avatar answered Nov 19 '22 13:11

Ben Voigt


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.

like image 1
Evgenyt Avatar answered Nov 19 '22 13:11

Evgenyt