PDA

Click to See Complete Forum and Search --> : mouseclicks and webbrowser control


code-elf
Dec 19th, 2000, 07:23 AM
Hello,

I'm doing a little project in which I have to monitor behaviour of users, when they are browsing through a nuber of (offline) webpages. I thought I could use the MS webbrowser control, for its ease of use. But it seems that this control is not able to catch mouseclicks or keypresses.
Has anyone a solution on how to monitor this?

Thanks,

Leon

Dec 19th, 2000, 10:49 AM
Use the GetAsyncKeyState API function.

Declare Function GetAsyncKeyState Lib "user32.dll" _
(ByVal vKey As Long) As Integer

Private Sub Timer1_Timer()
'Keypresses:
If GetAsyncKeyState(vbKeyA) Then Msgbox "A"
If GetAsyncKeyState(vbKeyB) Then Msgbox "B"
If GetAsyncKeyState(vbKeyC) Then Msgbox "C"
'.....
'Or catch any:
'Dim iKey As Integer
'For iKey = 3 to 255
'Print iKey
'Next iKey
'And for the mouse clicks:
If GetAsyncKeyState(vbLeftButton) Then Msgbox "Left"
If GetAsyncKeyState(vbMiddleButton) Then Msgbox "Middle"
If GetAsyncKeyState(vbRightButton) Then Msgbox "Right"
End Sub

code-elf
Dec 19th, 2000, 03:36 PM
Thanks,

Altough it shall not win a price for beauty (I dislike the use of timers). But apart from that it looks easy and straightforward.

Leon