1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

help with C++ code

Discussion in 'C++' started by Andres, Jul 22, 2008.

  1. Andres

    Andres New Member

    Joined:
    Jul 22, 2008
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    0
    Is there a way to get the coordinates of the mouse using C++ codes?
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    what operating system? (there isn't only one)
    what compiler are you using, and more importantly what class library or API are you using? (there are multiple compilers per platform and multiple APIs and class libraries)
     
  3. Andres

    Andres New Member

    Joined:
    Jul 22, 2008
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    0
    Well I am using Windows XP Professional SP2. I am using the Bloodshed Dev-C++ Version 4.9.9.2 compiler. I am not sure of which library to use. Can you help me?
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Two ways come to mind; you can call GetCursorPos, which is part of the WinAPI, or you can check for WM_MOUSEMOVE in your message loop and pick up the position from lParam.
     
  5. Andres

    Andres New Member

    Joined:
    Jul 22, 2008
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    0
    I am new with C++ and don't know all the codes. Can you guide me on how I can start the program and then I'll take it from there please.
     
  6. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    If you've only just started I suggest you leave the GUI stuff until you've got the hang of the language. If you don't know how to call GetCursorPos then that sort of stuff is way too advanced for you at this stage.
     

Share This Page