Home
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
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
 
 
 
 
 
 
 
TitleLet the user move a 1-pixel wide form without a title bar
Keywordsmove form, no title bar, drag form
CategoriesControls, API
 
Set the form's KeyPreview property to True. In the KeyDown event handler, look for the Control-M combination. When you see it, send the form the WM_NCLBUTTONDOWN message with the HTCAPTION parameter. This tells the form that the user has pressed the mouse down on its title bar and that starts moving the form.
 
Private Sub Form_KeyDown(KeyCode As Integer, Shift As _
    Integer)
    ' See if this is Control-M.
    If (Shift = vbCtrlMask) And (KeyCode = vbKeyM) Then
        SendMessage hwnd, WM_NCLBUTTONDOWN, _
            HTCAPTION, 0&
    End If
End Sub
 
One catch: After you move the form, you need to click on it before you can move it again for some reason. Let me know if you figure out how to solve that little problem.
 
 
Copyright © 1997-2001 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated