Mega Code Archive

 
Categories / Delphi / System
 

Trapping for when a user is done resizing a window

Title: Trapping for when a user is done resizing a window Question: I want to trap when the user is finished sizing or moving my window. I trapped the WM_SIZE and the WM_MOVE messages, but I receive many of these messages, and seems impossible to tell when the user Answer: The following example demonstrates trapping the WM_EXITSIZEMOVE message to determine when the user has exited a Window sizing or moving event. Although the message is documented as available only under Windows NT, it does work equally as well under Windows 95. Note that you can also trap the WM_ENTERSIZEMOVE to determine when the user is initiating a window move or size operation. Example: type TForm1 = class(TForm) private { Private declarations } public procedure WMEXITSIZEMOVE(var Message: TMessage); message WM_EXITSIZEMOVE; { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.WMEXITSIZEMOVE(var Message: TMessage); begin Form1.Caption := 'Finished Moving and sizing'; end;