|
-
Mar 7th, 2000, 06:44 AM
#1
Thread Starter
New Member
Is it possible to make a program in VB automatically move the mouse cursor to a posistion on the screen and then "double click itself"? What i mean by "double click itself" is that the computer executes a double click. If you know how, please email me, I'd appreciate it. Thank you
-
Mar 7th, 2000, 06:57 AM
#2
Lively Member
Hi,
You can do the move cursor positon easily using the API call;
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Declare Sub SetCursorPos Lib "User" (ByVal X As Integer, ByVal Y As Integer)
To "double click" the item underneath it you should find the window that you are wanting to click by calling;
Public Declare Function WindowFromPoint Lib "user32" Alias "WindowFromPoint" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
That will get you the window handle. Now you can send a message to this window. The message you want (And now I'm guessing) is WM_LBUTTONDBLCLK for Leftbutton double click.
I've not tried any of this but this is how I'd do it !
let me know if it works
cheers
Andy
-
Mar 7th, 2000, 06:58 AM
#3
Hyperactive Member
Didn't anyone tell you??? None of us know what we are doing ;-)
What you are attempting to do is remote control the mouse such that you can get it to interact with another application.... effectively putting that other application on "auto-pilot" as it were.
You really need to say this in your posts... I could describe the process of "baking a cake" to you but if I didn't tell you what I was doing you could think I was making a bomb ;-)
There are many ways to do what you are saying and most of them I believe require sending the messages to the application to tell it what events have occured. Effectively this is how windows interacts with a GUI application... the mouse itself hasn't actually done anything but windows knowing its location and what you did with it passes a message to the application that a mouse at position X,Y has just been double clicked and its up to the application to determine what that means.
Its not an easy task... you have lots of reading ahead of you... far to much to just put down quickly here.
-
Mar 7th, 2000, 11:52 PM
#4
Frenzied Member
Use the mouse_event API
Find out about the mouse_event API function, which synthesizes mouse input by placing mouse input information into the input stream (uncluding movements and clicks), here.
Sorry I can't give you and example, but no time now. Check out Serge's answer to this Previous Post.
Good luck,
~seaweed
-
Mar 8th, 2000, 02:46 AM
#5
New Member
Good point Gen-X (we're all lost)
I think what Incendiary might be asking is to have a command button's click event activate. If this is the case, all that API talk isnt necessary. simply say
command1.click = true
when ever you want the code inside the click event to fire.
Then again, I could have misunderstood what was asked (not unsual)
Matt Calderaro
Public Software
-
Mar 8th, 2000, 03:11 AM
#6
Lively Member
But then command.value = true would only give you a single click
cheers
Andy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|