Answer has been edited!
If I got you right, you might want to forbid double-click by title bar in order to prevent restoring form to its original size. You can do that by intercepting WM_NCLBUTTONDBLCLK.
In the example below I've overridden WndProc method of main form and hook forementioned message.
procedure TForm1.WndProc(var Message: TMessage);
begin
case Message.Msg of
WM_NCLBUTTONDBLCLK:
begin
case TWMNCHitMessage(Message).HitTest of
HTCAPTION:
Exit
else // Another HitTest-codes are handled here
Inherited WndProc(Message);
end;
end
else
Inherited WndProc(Message);
end;
end;
Important note
Although now you cannot restore maximized form by double-clicking, it still can be restored just by moving it while mouse is captured by title bar. At least, on Windows 7 this effect is presented.
Steps to reproduce:
- Run application;
- Press left mouse button while it hovered over title bar;
- Don't release LMB and move mouse softly - now form restores its size.
Addendum
Fixed bug with incorrect handling another non-client HitTest-codes excepting HTCAPTION (thanks to user Dsm for pointing this out!).