Console Question

This is a discussion on Console Question within the C++ Programming forums, part of the General Programming Boards category; GetConsoleCursorInfo() doesn't do it... what I need is a way to find the X, Y position of the cursor. Are ...

  1. #1
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Posts
    330

    Console Question

    GetConsoleCursorInfo() doesn't do it... what I need is a way to find the X, Y position of the cursor. Are there any functions that will tell me where the cursor is at any time?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789

    Re: Console Question

    Originally posted by rmullen3
    GetConsoleCursorInfo() doesn't do it... what I need is a way to find the X, Y position of the cursor. Are there any functions that will tell me where the cursor is at any time?
    Try GetConsoleScreenBufferInfo()...the second param is a pointer to a CONSOLE_SCREEN_BUFFER_INFO....and the dwCursorPosition member of that structure will give you the info you seek

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    106
    rmullen, long time no see man. I have a question of my own. What is your AOL AIM SN? I need to talk to you now. I'll answer your question. Its quite simple really.

    #include <iostream>
    #include <windows.h>

    int main()
    {
    HANDLE hOutput;
    COORD cursorposition={X, Y};

    hOutput=GetStdHandle(STD_OUTPUT_HANDLE);

    SetConsoleCursorPosition(hOutput, cursorposition);

    cursorposition.X= // your X position;
    cursorposition.Y= // your Y position;

    int x=500;
    Sleep(x);
    return 0;
    }

  4. #4
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Posts
    330
    I mean, if none of that is accessible in a function. To retrieve it from the system itself. I'm trying to do scrolling for a text-project, and to update this bar at the top of the screen I'd need to be able to know where the cursor is, because I wouldn't have the cursors X and Y stored in a variable I created.

    Thanks Fordy, I'll check that out

  5. #5
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Posts
    330
    I mean, if none of that is accessible in a function. To retrieve it from the system itself. I'm trying to do scrolling for a text-project, and to update this bar at the top of the screen I'd need to be able to know where the cursor is, because I wouldn't have the cursors X and Y stored in a variable I created.

    Thanks Fordy, I'll check that out

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. One process with two console windows
    By siavoshkc in forum Windows Programming
    Replies: 8
    Last Post: 01-30-2009, 04:13 PM
  2. Simple Novice Question: MS DOS app. a console?
    By renurv in forum C++ Programming
    Replies: 7
    Last Post: 12-30-2005, 02:42 PM
  3. Full Screen Console
    By St0rmTroop3er in forum C++ Programming
    Replies: 1
    Last Post: 09-26-2005, 10:59 PM
  4. Question type program for beginners
    By Kirdra in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2002, 06:10 AM
  5. Win2K/XP console question
    By d00b in forum Windows Programming
    Replies: 8
    Last Post: 08-05-2002, 02:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21