home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Unique_Too20380012162006.psc / PlanetSourceCodeSearch_vb / FormControl.bas < prev    next >
BASIC Source File  |  2006-12-14  |  2KB  |  35 lines

  1. Attribute VB_Name = "modFormControl"
  2. 'Please Visit - http://Rbgcode.com
  3.  
  4. 'For Dragging Borderless Forms...
  5. Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  6. Public Declare Function ReleaseCapture Lib "user32" () As Long
  7. Public Const WM_NCLBUTTONDOWN = &HA1
  8. Public Const HTCAPTION = 2
  9.  
  10. 'For Animating Windows
  11. Public Const AW_HOR_POSITIVE = &H1 'Animates the window from left to right. This flag can be used with roll or slide animation.
  12. Public Const AW_HOR_NEGATIVE = &H2 'Animates the window from right to left. This flag can be used with roll or slide animation.
  13. Public Const AW_VER_POSITIVE = &H4 'Animates the window from top to bottom. This flag can be used with roll or slide animation.
  14. Public Const AW_VER_NEGATIVE = &H8 'Animates the window from bottom to top. This flag can be used with roll or slide animation.
  15. Public Const AW_CENTER = &H10 'Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
  16. Public Const AW_HIDE = &H10000 'Hides the window. By default, the window is shown.
  17. Public Const AW_ACTIVATE = &H20000 'Activates the window.
  18. Public Const AW_SLIDE = &H40000 'Uses slide animation. By default, roll animation is used.
  19. Public Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
  20. Public Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean
  21.  
  22. '
  23.  
  24. Public Sub DragForm(Frm As Form)
  25.  
  26. On Local Error Resume Next
  27.  
  28. 'Move the borderless form...
  29. DoEvents
  30. Call ReleaseCapture
  31. DoEvents
  32. Call SendMessage(Frm.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
  33. DoEvents
  34. End Sub
  35.