CodeItBetter Programming Another VB Programming Blog

How to Check whether Mouse exist or not

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'System & API - How to Check whether Mouse exist or not

Option Explicit
 
Public Const SM_CMOUSEBUTTONS = 43
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
 
Public Function CheckMouse() As Boolean
    CheckMouse = GetSystemMetrics(SM_CMOUSEBUTTONS) > 0
End Function
 
'How can I call this function:
Private Sub Main()
    If CheckMouse Then
        Call MsgBox("The Mouse exist on your system.", vbInformation, App.Title)
    Else
        Call MsgBox("The Mouse doesn't exist on your system.", vbInformation, App.Title)
    End If
End Sub

Related posts:

  1. How to Get the number of Mouse Buttons
  2. How to get the NumLock state whether it is on or off
  3. How to check whether you are connected with internet
  4. How to Enable/Disable Mouse trails
  5. How to disable the Mouse until Reboot
  6. How to show Mouse Properties Control Panel
  7. How to find whether the given directory is empty (in three ways)
  8. How to Set Mouse Cursor position
  9. How to Swap Mouse Buttons
  10. How to Get Mouse Double Click Time

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.