Results 1 to 8 of 8

Thread: Moving the mouse. Help!

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    44

    Question

    (*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

  2. #2
    Guest

    Shalom Namo!

    To move the mouse:

    Put this in a module:
    Code:
    Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    Form Code:
    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]

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    when you say make a click event do you maen detect a mouse click or send a mouseclick to a window?


  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    44
    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

  5. #5
    Guest
    Here you go, I found a way to make the mouse click:

    Code:
    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.

  6. #6

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    44

    Thumbs up

    Thanks Again! and again and again and again.....


  7. #7

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    44

    Question

    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.

  8. #8

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    44

    Lightbulb

    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

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