Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Mar 4, 2000

Determine the number of mouse buttons

Sometimes is useful to know how many buttons the user's mouse has. This value can be obtained by calling GetSystemMetrics. The constant to pass as parameter is SM_ CMOUSEBUTTONS. Here's an example:


Const SM_CMOUSEBUTTONS = 43
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) _
    As Long

Function GetNumMouseButtons() As Long
    GetNumMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS)
End Function

Private Command1_Click()
    MsgBox "Your mouse has " & GetNumMouseButtons & " buttons."
End Sub

Marco Bellinaso
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date