Results 1 to 6 of 6

Thread: This question is for people who know what they are doing.....

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    1

    Post

    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

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    North Yorkshire
    Posts
    102

    Post

    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

  3. #3
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461

    Post

    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.

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Post 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

  5. #5
    New Member
    Join Date
    Mar 2000
    Location
    venice, fl 34285
    Posts
    8

    Post

    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

  6. #6
    Lively Member
    Join Date
    Jan 2000
    Location
    North Yorkshire
    Posts
    102

    Post

    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
  •  



Click Here to Expand Forum to Full Width