Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating a mouse click using SendMessage
Message
From
10/12/1998 11:32:21
Rob Gordon
Xon Digital Communications Ltd.
Dartmouth, Nova Scotia, Canada
 
 
To
All
General information
Forum:
Visual Basic
Category:
Windows API functions
Title:
Generating a mouse click using SendMessage
Miscellaneous
Thread ID:
00166122
Message ID:
00166122
Views:
83
I am trying to programmatically move a mouse around and generate mouse clicks in a app containing a WebBrowser (ie4) Active X control.
I tried using SendMessage to move the cursor around but had no luck.
I can move the mouse around OK with SetCursorPos but you need (I believe) SendMessage to generate the mouse click.

Any help would be much appreciated ..



EG,
Public Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type

Public Type POINT
x As Long
y As Long
End Type

Moving the cursor around .. this will move to the center of the window .. works fine

Dim CurPosition as POINT
Dim Client as RECT

get the client area
GetClientRect Me.hwnd, Client

CurPosition.x = Client.Bottom/2
CurPosition.y = Client.right/2
ClientToScreen Me.hwnd, CurPosition
t = SetCursorPos(CurPosition.x, CurPosition.y)

But trying to generate a mouse click at this (or any) point doesn't work

ScreenToClient Me.hwnd, CurPosition
Dim lParameter as long
lParameter = (CurPosition.y) * 65535 + CurPosition.x
t=SendMessage(me.hWnd,WM_LBUTTONDOWN,0&,lParameter&)

or for that matter ..
t=SendMessage(me.hWnd,WM_MOUSEMOVE,0&,lParameter&)
Reply
Map
View

Click here to load this message in the networking platform