Simulating mouse movements and Clicks on the Keyboard 
Author Message
 Simulating mouse movements and Clicks on the Keyboard

I am using VB4 and I want to move the mousepointer, and perform

the 'click' event without touching the mouse. For example using

the keys U, D, L, R and RETURN.  Any suggestions for a relative

newcomer to VB.  

Gareth Jones



Sat, 02 Sep 2000 03:00:00 GMT  
 Simulating mouse movements and Clicks on the Keyboard

I am using VB4 and I want to move the mousepointer, and perform

the 'click' event without touching the mouse. For example using

the keys U, D, L, R and RETURN.  Any suggestions for a relative

newcomer to VB.  

Gareth Jones



Sat, 02 Sep 2000 03:00:00 GMT  
 Simulating mouse movements and Clicks on the Keyboard

Quote:

>I am using VB4 and I want to move the mousepointer, and perform
>the 'click' event without touching the mouse. For example using
>the keys U, D, L, R and RETURN.  Any suggestions for a relative
>newcomer to VB.  

Under NT4, in the accessibility control panel applet, there is a
feature called mousekeys. Works for this.
If u are under Win95, I don't know, but you can check it yourself.

HTH.

--
Alfonso Montero Lopez

Quitar la palabra XXREMOVE al responder a mi direccion.
Remove the word XXREMOVE when replying to my address.



Mon, 04 Sep 2000 03:00:00 GMT  
 Simulating mouse movements and Clicks on the Keyboard

Here it is in VB3.  The more part.  The click part is just a call to
the click event of the control.  No magic needed.

If you need it in VB5, let me know.

  Declare Sub ClientToScreen Lib "User" (ByVal hwnd%, lpPoint As
POINTAPI)
  Declare Sub SetCursorPos Lib "USER" (ByVal x%, ByVal y%)
  Declare Function agXTwipsToPixels% Lib "apiguide.dll" (ByVal twips&)
  Declare Function agYTwipsToPixels% Lib "apiguide.dll" (ByVal twips&)

Sub SetMouseFocus (wf As Form, wc As Control)

  'SetMouseFocus Screen.ActiveForm, cmdOK

  'This routine moves the mouse cursor to the middle of a control

   Dim tx As Integer, ty As Integer
   Dim pt As POINTAPI

   tx = wc.Left + (wc.Width / 2)
   ty = wc.Top + (wc.Height / 2)

   pt.x = agXTwipsToPixels(tx)
   pt.y = agYTwipsToPixels(ty)

   ClientToScreen wf.hWnd, pt
   SetCursorPos pt.x, pt.y

End Sub

Mike Morrow



Quote:
>I am using VB4 and I want to move the mousepointer, and perform

>the 'click' event without touching the mouse. For example using

>the keys U, D, L, R and RETURN.  Any suggestions for a relative

>newcomer to VB.  

>Gareth Jones



Tue, 05 Sep 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Trapping mouse movement, keyboard clicks etc.

2. Simulating Mouse Movement

3. Enable/Disable mouse clicks and keyboard key clicks

4. Keyboard and Mouse movement events...

5. Simulate mouse and keyboard

6. Key Clicks and mouse movements

7. Detecting Keystrokes and Mouse Movements/Clicks

8. How can I simulate mouse clicks

9. Programmatically Simulate a Mouse Click

10. Simulate a mouse click

11. Simulate the mouse click

12. simulate mouse click w/o moving cursor

 

 
Powered by phpBB® Forum Software