home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Monkamp227297132001.psc / drag.bas < prev    next >
Encoding:
BASIC Source File  |  2001-06-10  |  1.0 KB  |  32 lines

  1. Attribute VB_Name = "drag"
  2. Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  3. Public Declare Function ReleaseCapture Lib "user32" () As Long
  4. Public Const WM_SYSCOMMAND = &H112
  5. Public Const WM_MOVE = &HF012
  6. '
  7. ' Example:
  8. '
  9. ' Private Sub BLAH_MouseDown(STUFF)
  10. ' Call FormDrag Me or (X)
  11. ' End Sub
  12. '
  13. '--------------------------------------------------------------------------
  14. '
  15. ' BLAH = the thing being pressed ( i.e. a command button or
  16. ' a picture or something )
  17. '
  18. ' STUFF = all the crap thats in that thing when u make it MouseDown.
  19. ' Don't worry about STUFF.  Its does it automaticially.
  20. '
  21. ' If you type me, VB recognizes it as the current form.  So if you
  22. ' type Me, Me is the current form.  Usually you want to type Me instead
  23. ' of the form name.
  24. '
  25. ' X = the name of the form u want to drag
  26. '
  27. Public Sub FormDrag(FormName As Form)
  28. Call ReleaseCapture
  29. Call SendMessage(FormName.hWnd, WM_SYSCOMMAND, WM_MOVE, 0)
  30. End Sub
  31.  
  32.