Thread: get the console cursor position, not set it

  1. #1
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753

    get the console cursor position, not set it

    does any body know of a windows API function that gets the cursor console position, not set it?

    to set it i use:
    Code:
    void gotoxy(int x, int y)
    {
        coord.X = (short)x;
        coord.Y = (short)y;
        SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
    }
    is there a way to GET where it currently is?

    and please don't tell me to read the faq.

  2. #2
    Registered User Zeeshan's Avatar
    Join Date
    Oct 2001
    Location
    London, United Kingdom
    Posts
    226
    see the faq....

    nay ... just kidding... here's what you need


    BOOL GetConsoleScreenBufferInfo (
    HANDLE hConsoleOutput, // handle to screen buffer
    PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo //screen buffer information
    );

    typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
    COORD dwSize;
    COORD dwCursorPosition; // <-- here's what you want
    WORD wAttributes;
    SMALL_RECT srWindow;
    COORD dwMaximumWindowSize; } CONSOLE_SCREEN_BUFFER_INFO ;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. optimising program
    By SONU in forum C Programming
    Replies: 1
    Last Post: 05-18-2008, 10:28 AM
  2. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  3. Full Screen Console
    By St0rmTroop3er in forum C++ Programming
    Replies: 1
    Last Post: 09-26-2005, 09:59 PM
  4. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM