PDA

Click to See Complete Forum and Search --> : Moving the mouse. Help!


Namo
May 27th, 2000, 12:23 AM
(*sorry about my enlish, i am from Israel*)

Hi
I wanna ask few very important questions.

1. How can i move the MOUSE (with API call/s..without moving the mouse..) I wanna move the mouse all over the screen . not only at a VB form...

2. Is it possibe to make a Click event of the mouse (that moves all oven the screen).


Is it possible? any info will be great. I will very happy to get an examples

Thanks!
Nimrod/Namo
Israel

May 27th, 2000, 01:18 AM
To move the mouse:

Put this in a module:

Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long

Form Code:

Dim t&
t& = SetCursorPos(0, 0) 'set it to any point


It is possible to make the mouse click wherever it goes...but I don't know the code to that :P.

[Edited by Matthew Gates on 05-27-2000 at 02:24 PM]

Sam Finch
May 27th, 2000, 02:14 AM
when you say make a click event do you maen detect a mouse click or send a mouseclick to a window?

Namo
May 27th, 2000, 04:29 AM
Matthew Gates - Thank you very much!! (toda)

Sam Finch -
I mean send a mouse click to a window.

I want it to fire the "click event" that will work for all the screen.. not just on the form for example...
(if it will be "clicked" on a icon of shortcut . then it will work..)

Thnaks
Nimrod/Namo

May 27th, 2000, 09:30 AM
Here you go, I found a way to make the mouse click:

Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4

Call mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&)

Hope that helps.

Namo
May 28th, 2000, 05:39 AM
Thanks Again! and again and again and again.....

Namo
May 28th, 2000, 06:09 AM
Hmm - Gats.. Something not working for me. the API call works fine.. (no errors or something) but when i "fire" the mouse left click event nothing happen..

For example. if i put the mouse over a Link to http://www.nba.com (on IE) and then i fire the evet with the api call.. then it is NOT going to nba.com ... i want it wt work like a real user clicked on it.

You understand what i mean? any idea whats the problem or how to do it?

Namo.

Namo
May 28th, 2000, 06:16 AM
Ok ok. i konw how to use it.. if you wanna do it you need to 2 API functions.. (for 1 real click)

Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&)
Call mouse_event(MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&)

Unless it wont work :)

Ok.
have a nice day
Nimrod/Namo