- I create a window without a title.
- I change it manually (or programmatically) so that its height is 30 pixels or less.
- When I then take the lower bound to change it vertically, it behaves as if I had dragged the upper bound. Indeed, when debugging a program, the WM_SIZING parameter contains WMSZ_TOP instead of WMSZ_BOTTOM.
My program is written in Delphi, basically the problem reproduces with the main form with the following FormCreate:
procedure TForm2.FormCreate(Sender: TObject);
var oldStyle : LongInt;
var newStyle : LongInt;
begin
// Adapt windows style.
oldStyle := WINDOWS.GetWindowLong (
handle,
GWL_STYLE);
newStyle := oldStyle and
(not WS_CAPTION) and
(not WS_MAXIMIZEBOX);
WINDOWS.SetWindowLong(
handle,
GWL_STYLE,
newStyle);
// SetWindowPos with SWP_FRAMECHANGED needs to be called at that point
// in order for the style change to be taken immediately into account.
WINDOWS.SetWindowPos(
handle,
0,
0,
0,
0,
0,
SWP_NOZORDER or
SWP_NOMOVE or
SWP_NOSIZE or
SWP_FRAMECHANGED or
SWP_NOACTIVATE);
end;
source
share