Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using API calls to move the mouse and generate clicks
Message
De
11/12/1998 16:47:21
 
 
À
11/12/1998 14:45:59
Rob Gordon
Xon Digital Communications Ltd.
Dartmouth, Nouvelle-Écosse, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00166699
Message ID:
00166799
Vues:
12
If you have VC++ installed, then you also have the Spy++ program. Use it to spy the mouse messages. This way you can see exactly what messages are sent inside Windows.

Pay attention to the first letter on each row in Spy's window (second column)
for messages. "S" means SendMessage, "R" means result returned by SendMessage and "P" means PostMessage.

The difference between Send and Post is that Send waits for a response and Post doesn't wait (so, it doesn't return any value).

Vlad

>I originally posted this to the VB section .. but nobody uses it so I'm trying here .. the question is pretty generic anyhow. How to move a Mouse around the screen and generate clicks programatically in VB. In Foxpro, of course, you just use MOUSE AT .... etc
>
>
>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 ..
>
>
>This is a VB example .. my apologies ..
>
> 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&)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform