Results 1 to 16 of 16

Thread: Send Mouse Key? [Resolved]

  1. #1

    Thread Starter
    Addicted Member Rogier's Avatar
    Join Date
    Jun 2004
    Location
    Netherlands
    Posts
    143

    Question Send Mouse Key? [Resolved]

    Hi,

    Can I send a mouseclick?
    Like
    VB Code:
    1. SendKeys "{Space}"
    is for keys from your keyboard.....but how can I do this from the mouse?

    Thanks
    Last edited by Rogier; Nov 24th, 2004 at 07:38 AM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    you can call a control's click event like a subroutine. (maybe I should give you a goofy answer instead)

  3. #3

    Thread Starter
    Addicted Member Rogier's Avatar
    Join Date
    Jun 2004
    Location
    Netherlands
    Posts
    143
    LOL

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    we don't need replies to the things that you don't know.

  5. #5

    Thread Starter
    Addicted Member Rogier's Avatar
    Join Date
    Jun 2004
    Location
    Netherlands
    Posts
    143
    OK I'm really sorry......I was typing and meanwhile I thougt: "no, that's not the answer"
    Sorry

  6. #6
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    Do you just want to send a click, or is there a target?
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    is it your program, or do you want to click on someone else's program? btw - You could just use {Enter} instead of a click.

  8. #8
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    Look into the mouse_event API, which will simulate a mouse click where ever the cursor is.

    If you want to target a specific window, use the SendMessage API to send the WM_LBUTTONDOWN, and WM_LBUTTONUP messages.
    Last edited by Megatron; Nov 22nd, 2004 at 05:17 PM.

  9. #9

    Thread Starter
    Addicted Member Rogier's Avatar
    Join Date
    Jun 2004
    Location
    Netherlands
    Posts
    143
    I want to click in an other window.
    Like: you press a button and 3 seconds later the mouse clicks one time, doesn't matter in what windows you are.

  10. #10
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    Two methods (as described in my earlier post).

    Method 1)
    -Use FindWindow to get the handle of the window
    -If necessary, position the cursor via SetCursorPos
    -Invoke the mouse_event() API to click the mouse

    Method 2)
    -Get the handle of window via FindWindow
    -Send the WM_LBUTTONDOWN and WM_LBUTTONUP messages to it

  11. #11

    Thread Starter
    Addicted Member Rogier's Avatar
    Join Date
    Jun 2004
    Location
    Netherlands
    Posts
    143
    hmmm......I think I am missing some files..........because I don't see one of that API's

  12. #12
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    Which one do you need?

  13. #13

    Thread Starter
    Addicted Member Rogier's Avatar
    Join Date
    Jun 2004
    Location
    Netherlands
    Posts
    143
    I don't know. Thanks for your help, I'll call this trheat Resolved, it isn't but that doesn't matter anymore.

    thnx

  14. #14
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    If you can get the declarations, this should do the trick
    Code:
    handle = FindWindow("ClassName", "WindowTitle")
    If Handle Then
        PostMessage handle, WM_LBUTTONDOWN, MK_LBUTTON, 0
        PostMessage handle, WM_LBUTTONUP, MK_LBUTTON, 0
    End If

  15. #15
    New Member
    Join Date
    Dec 2004
    Posts
    7

    Re: Send Mouse Key? [Resolved]

    how do i make a program to click on specific coordinate x and y

  16. #16

    Thread Starter
    Addicted Member Rogier's Avatar
    Join Date
    Jun 2004
    Location
    Netherlands
    Posts
    143

    Lightbulb Re: Send Mouse Key? [Resolved]

    I want to know that too!

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