Results 1 to 9 of 9

Thread: Moving the mouse...

  1. #1
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default Moving the mouse...

    I'm having a bit of trouble moving the mouse.

    I can move the mouse just fine, but it doesn't recognize the active window's boundaries.

    Meaning... I tell it to move the mouse to the form's upper-left corner (0, 0), but it moves it to to the Screen's upper-left corner. Help?

    Also, what's the best command to use to move the mouse?

    So far I've found:

    SetCursorPos(X, Y);

    Mouse.CursorPos := TPoint;

    and

    Mouse_Event(MOUSEEVENTF_MOVE, TPoint.X, TPoint.Y, 0, GetMessageExtraInfo);

    Are there any differences between the three?

  2. #2
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Sounds like the first is MoveMouse. You should try reconstructing the mouse procedure from SRL in Delphi. It would be great experience.

    Anyways, I have no clue about your problem. I'm guessing the SetClientWindowHandle is native to SCAR? Or did it come directly from Delphi?


  3. #3
    Join Date
    Dec 2006
    Location
    .̿̂̔͋͗̎̆ͥ̍̒ͤ͂̾̌̀̅
    Posts
    3,012
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    No clue :S Maybe you should ask freddy?

  4. #4
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Add the client window's screen position to the coordinates you want to move the mouse to?
    Interested in C# and Electrical Engineering? This might interest you.

  5. #5
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    I guess I could do that. Mark where the client's position is in relation to the rest of the screen. I'd hate to bug Freddy about this

  6. #6
    Join Date
    Feb 2006
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Get the wanted windows coords with
    Code:
    function GetWindowRect(HWnd : LongInt; var Rect : TRect)
    You could use ClientToScreen.

    Is it your form you are navigating around, or another window?

  7. #7
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Ty Spky

    It's my form, and what exactly does ClientToScreen do?

  8. #8
    Join Date
    Feb 2006
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You need only use ClientToScreen. It just calculates the coords so MoveMouse(0, 0) will move to your forms Top, Left instead of the screens.

    Code:
    procedure MoveMouse(x, y: Integer) ;
    var 
     Point: TPoint;
    begin
       Point:= ClientToScreen(Point(x, y)) ;
       SetCursorPos(Point.x, Point.y) ;
    end;

  9. #9
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Awesome, Thanks

    Easier than I thought it was gonna be.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mouse moving wierd...
    By Aser in forum OSR Help
    Replies: 0
    Last Post: 01-17-2009, 11:46 PM
  2. help with moving mouse? again?
    By joshdabest01 in forum OSR Help
    Replies: 3
    Last Post: 11-01-2008, 12:54 PM
  3. help with moving mouse?
    By joshdabest01 in forum OSR Help
    Replies: 2
    Last Post: 11-01-2008, 09:52 AM
  4. [help] Moving mouse in a circle.
    By enig.ma in forum OSR Help
    Replies: 5
    Last Post: 12-26-2007, 02:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •