Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I detect when a form moves? 3

Status
Not open for further replies.

scorpio66

Programmer
Jun 27, 2001
229
GB
It must be late. How do you detect when one of your forms is moved around the screen? I've been looking for an equivalent to the Resize event (maybe Move?) but can't seem to find one.

Chaz
 
Maybe i don't quite understand the question and execuse me if I am wrong but couldn't you get the starting me.top and me.left coordinates and then in a timer use if statements to look for movement?

It might work?
 
Subclass it and examine either or both the following messages:

WM_MOVE
WM_WINDOWPOSCHANGED
 
If you set Autoredraw to false, the Paint Event is fired af the form is "dropped" in place on the screen. If you do a move in the paint event, protect youself with a flag against cascading paine events.
 
I've always found waiting for the Paint event slightly unreliable.
 
Strongm has the right idea . . . subclass the window and watch for the following messages . . .

WM_MOVE
WM_WINDOWPOSCHANGED - Jeff Marler B-)
 
Since I already had subclassing of the form in place I just extended it to trap the WM_MOVE event and it works like a charm.

Thanks

Chaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top