CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2006
    Posts
    203

    How to set mouse position in linux,mac

    Hi,
    To set the mouse position in windows
    POINT pt;
    pt.x=pt.y=100;
    ClientToScreen(GetActiveWindow(),&pt);
    SetCursorPos(pt.x,pt.y);
    here we need to change client coordinates to screen coordinates

    To get the mouse position in windows
    GetCursorPos(&pt);
    ScreenToClient(GetActiveWindow(),&pt);// to get the coordinate for current window

    But i dont have any idea how to do the same for MAC/Linux/OS2 opereating systems
    please tell how to do this for other OS

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: How to set mouse position in linux,mac

    Quote Originally Posted by MFCQuery
    But i dont have any idea how to do the same for MAC/Linux/OS2 opereating systems
    please tell how to do this for other OS
    You mentioned 3 different operating systems with different ways of doing these things.

    Why not do a google search for the information?

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Nov 2006
    Location
    Essen, Germany
    Posts
    1,344

    Re: How to set mouse position in linux,mac

    I think it´s impossible when using the native OS SDK because there are different APIs. If you want to target multiple platforms you have to use a toolkit that is available for all target platforms. wxWidgets or Trolltech´s Qt may be what you are looking for.
    - Guido

  4. #4
    Join Date
    Aug 2005
    Location
    LI, NY
    Posts
    576

    Re: How to set mouse position in linux,mac

    It's also probably worth noting that programmatically moving the cursor is against Apple's user interface guidelines, and they may not provide a documented function to do this in their APIs.
    - Alon

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

Featured