2011. február 14., hétfő

Hook into the WM_WindowPosChanging message


Is it somehow possible to "check" in the WM_WindowPosChanging message if the window is resized?


In this message, Msg.WindowPos^.flags holds the flags which were originally used with the SetWindowPos, etc. functions. The window will change its size if SWP_NOSIZE is not contained in this flags, and either cx or cy are different, compared to Width and Height values of the form:

procedure TForm1.WMWindowPosChanging(var Msg: TWMWindowPosChanging);
if (Msg.WindowPos^.flags and SWP_NOSIZE = 0) and ((Msg.WindowPos^.cx <> Width)
or (Msg.WindowPos^.cy <> Height)) then
Windows.Beep(1000, 20); {sizing}

Nincsenek megjegyzések:

Megjegyzés küldése