Code to Detect the Mouse and number of buttons present on the mouse
Code to Detect the Mouse and number of buttons present on the mouse
API Declarations
Private Const SM_CMOUSEBUTTONS = 43
Private Const SM_MOUSEPRESENT = 19
Dim X As Long, Y As Long
Dim S As String
Rate Code to Detect the Mouse and number of buttons present on the mouse
(2(2 Vote))
Private Sub Command1_Click()
X = GetSystemMetrics(SM_MOUSEPRESENT)
If X = 1 Then
Y = GetSystemMetrics(SM_CMOUSEBUTTONS)
S = "MOUSE IS PRESENT AND " & vbCrLf
S = S & "IT HAS " & CStr(Y) & " BUTTONS ON IT"
MsgBox S, vbExclamation, "Mouse"
Else
MsgBox "Attention! Mouse is not present", vbCritical, "Mouse"
End If
End Sub
Code to Detect the Mouse and number of buttons present on the mouse Comments
No comments yet — be the first to post one!
Post a Comment