home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD138641172001.psc / modFunctions.bas < prev    next >
Encoding:
BASIC Source File  |  2001-01-17  |  1.4 KB  |  54 lines

  1. Attribute VB_Name = "modFunctions"
  2. Public Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
  3. Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
  4. Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  5.  
  6. Public Type RECT
  7.     Left As Long
  8.     Top As Long
  9.     Right As Long
  10.     Bottom As Long
  11. End Type
  12.  
  13.  
  14. '*' The POINTAPI Type contains two properties.  The first is the X Property, which returns
  15. '*' the Horizontal Postion of the mouse as a long value, and the Y Property, which returns
  16. '*' the Vertical Postion of the mouse as a long value.
  17. '*'
  18. Public Type POINTAPI
  19.     x As Long
  20.     y As Long
  21. End Type
  22.  
  23. Public Function GetX() As Long
  24.  
  25. Dim POS As POINTAPI
  26.  
  27. '*' Call the GetCursorPos Function with the POINTAPI object that has been created.
  28. '*'
  29. GetCursorPos POS
  30.  
  31. '*' The value of X is now assigned to the X Property of the POS Object.  Assign this value
  32. '*' to the function and return the value.
  33. '*'
  34. GetX = POS.x
  35.  
  36. End Function
  37.  
  38. Public Function GetY() As Long
  39.  
  40. Dim POS As POINTAPI
  41.  
  42. '*' Call the GetCursorPos Function with the POINTAPI object that has been created.
  43. '*'
  44. GetCursorPos POS
  45.  
  46. '*' The value of X is now assigned to the X Property of the POS Object.  Assign this value
  47. '*' to the function and return the value.
  48. '*'
  49. GetY = POS.y
  50.  
  51. End Function
  52.  
  53.  
  54.