Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleKnow when a form is moving and when it finishes moving
Keywordsmoving, move, finished moving
CategoriesTips and Tricks, API
 
Subclass. Look for the WM_WINDOWPOSCHANGING message to know when the form is moving and the WM_EXITSIZEMOVE message to know when it has finished moving.

 
' Process messages.
Public Function NewWindowProc(ByVal hwnd As Long, ByVal msg _
    As Long, ByVal wParam As Long, lParam As WINDOWPOS) As _
    Long
Const WM_NCDESTROY = &H82
Const WM_WINDOWPOSCHANGING = &H46
Const WM_EXITSIZEMOVE = &H232

    ' If we're being destroyed,
    ' restore the original WindowProc.
    If msg = WM_NCDESTROY Then
        SetWindowLong _
            hwnd, GWL_WNDPROC, _
            OldWindowProc
    End If

    ' See if we are moving or done moving.
    If msg = WM_WINDOWPOSCHANGING Then Form1.Moving
    If msg = WM_EXITSIZEMOVE Then Form1.Moved

    ' Continue normal processing. VERY IMPORTANT!
    NewWindowProc = CallWindowProc( _
        OldWindowProc, hwnd, msg, wParam, _
        lParam)
End Function
 
For more information on subclassing including important precautions, see Tutorial: Subclassing.
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated