VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Code to Detect the Mouse and number of buttons present on the mouse

by S.Raghu (1 Submission)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 26th June 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



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

Download this snippet    Add to My Saved Code

Code to Detect the Mouse and number of buttons present on the mouse Comments

No comments have been posted about Code to Detect the Mouse and number of buttons present on the mouse. Why not be the first to post a comment about Code to Detect the Mouse and number of buttons present on the mouse.

Post your comment

Subject:
Message:
0/1000 characters