Not a Member Yet,
Click here to Register
How do you like the new design?
It's cool, great job
[tally: 70%] 70%
It's okay
[tally: 20%] 20%
Its OK but I liked the old layout better
[tally: 0%] 0%
Please bring the old one back
[tally: 10%] 10%

votes: 10

ID: 406
Viewed: 2722
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Mouse Class Module

Highlight all by clicking in box
<!---Declaration--->
Option Explicit

DefInt A-Z

Private Type POINTAPI_TYPE
x As Long
y As Long
End Type

Private Type RECT_TYPE
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Const SM_MOUSEPRESENT = 19
Private Const SM_SWAPBUTTON = 23
Private Const SM_CMOUSEBUTTONS = 43
Private Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As ong) As Long
Private Declare Function SwapMouseButton Lib "user32" _
(ByVal bSwap As Long) As Long
Private Declare Function SetCursorPos Lib "user32" _
(ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" _
(lppoint As POINTAPI_TYPE) As Long
Private Declare Function ShowCursor Lib "user32" _
(ByVal bShow As Long) As Long
Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Long) As Integer
Private Declare Function WindowFromPoint Lib "user32" _
(ByVal xPoint As Long, ByVal yPoint As Long) As Long

Highlight All
<!---Code--->
' returns True (-1) if mouse installed
Public Function mThere() As Boolean
mThere = GetSystemMetrics(SM_MOUSEPRESENT) = 1
End Function

' returns X pos of mouse
Public Property Get CurrentX() As Long
Dim pt As POINTAPI_TYPE
GetCursorPos pt
CurrentX = pt.x
End Property

' sets X pos of mouse
Public Property Let CurrentX(x As Long)
Dim pt As POINTAPI_TYPE
GetCursorPos pt
pt.x = x
SetCursorPos pt.x, pt.y
End Property

' returns Y pos of mouse
Public Property Let CurrentY(y As Long)
Dim pt As POINTAPI_TYPE
GetCursorPos pt
pt.y = y
SetCursorPos pt.x, pt.y
End Property

' sets Y pos of mouse
Public Property Get CurrentY() As Long
Dim pt As POINTAPI_TYPE
GetCursorPos pt
CurrentY = pt.y
End Property

'
' swapping routines
'
' swaps mouse buttons
Public Sub mSwap()
SwapMouseButton True
End Sub

'un-swaps mouse buttons
Public Sub Unswap()
SwapMouseButton False
End Sub

' returns True (-1) is buttons swapped
Public Function mSwapped() As Boolean
mSwapped = GetSystemMetrics(SM_SWAPBUTTON) = 1
End Function

'
' button state functions
'
;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions