Sunday, April 13, 2008

RIGHT MOUSE CLICK ON APPLE MOUSE ?



Few days ago, the keyboard and mouse i usually used my at office computer have spoilt cause by the frequently elecrticity break out at here. I was force to use alernate keyboard and mouse where there are no more spare keyboard and mouse left at the office. SWEAT -.-'''

At the end, i found the write off apple computer's keyboard and mouse. Well, honestly, i really happy to get these devices, it looks cool. hehe... ^.^ The keyboard is very nice, where it is nearly silent when i'm typing on the keyboard. This make my boss cant catch me on doing other thing else... hehe... nice le ? haha...

But the problem arise, when i use the mouse. I have just found out, that, apple mouse has only 1 click button!! Where the hell is my right click button?? -.-'''

I have been shaking head for fews days, trying to get myself to get use to 1 mouse buton. But, i failed to getting familiar with it. So, i have came out a solution to solve the right click issues on my apple mouse. By coding a program to call WinAPI to convert the left click to right click while pressing left shift button. Bellow are my codings on calling WinAPI and swapping the mouse button and get keyboard entery status.

Coding

Declare Function SwapMouseButton Lib "user32.dll" _
Alias "SwapMouseButton" (ByVal bSwap As Integer) As Integer
Private Declare Function GetKeyState Lib "user32.dll" _
(ByVal nVirtKey As Long) As Integer

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

If GetKeyState(160) > -10 Then

SwapMouseButton(0)

Else

SwapMouseButton(1)

End If
End Sub

3 comments:

SilentB said...

Good work! well i got my silent keyboard also after pc fair. Bought a few set and there r several spare one so i can use anytime hehehe :P

Pazuzu said...

wah .. u teaching ppl coding here ah?

hehehe


ur fren Pazuzu is here..

http://www.redspot.com.my/pazuzu

Derren said...

haha... just play play only la... din teach one la... hehe... share my things wif my frenz ma... :p