| 'is mouse
present and how many buttons
Private Declare Function GetSystemMetrics
Lib "User32" (ByVal index
As Long) As Long
Private Const SM_CMOUSEBUTTONS = 43
Private Const SM_MOUSEPRESENT = 19
Dim X As Long, Y As Long
Dim S As String
Private Sub Command1_Click()
X = GetSystemMetrics(SM_MOUSEPRESENT)
If X = 1 Then
Y = GetSystemMetrics(SM_CMOUSEBUTTONS)
S = "Mouse present " &
vbCrLf
S = S & "and it has "
& CStr(Y) & " buttons"
MsgBox S, vbExclamation, "Mouse"
Else
MsgBox "Attention! Mouse is not
present", vbCritical, "Mouse"
End If
End Sub
|