Главная страница | назад





Article #17024: Trapping for when a user is done resizing a window

 Question and Answer Database

FAQ2024D.txt   Trapping for when a user is done resizing a window
Category   :Windows API
Platform    :All
Product    :All 32 bit  

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 has
completed the operation. How can I tell when the user is finished
moving and sizing the window?

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;


7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99