?
Solved

How to get console cursor position using VC++?

Posted on 2001-09-06
9
Medium Priority
?
1,599 Views
Last Modified: 2008-02-01
How to get console cursor position using VC++?
and how to set the cursor info?

Thanks.
0
Comment
Question by:Knight_G
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 2

Expert Comment

by:bkdc
ID: 6460113
To determine the current cursor position and attributes call GetConsoleScreenBufferInfo(..).
 SetConsoleTextAttribute changes the text color.
 You might try SetConsoleMode / GetConsoleMode too.
 SetConsoleCursorPosition - you figure it ....
0
 

Author Comment

by:Knight_G
ID: 6460194
Can you pls write the exact usage of
GetConsoleScreenBufferInfo,
SetConsoleMode
SetConsoleCursorInfo

I had refered to the MSDN library, but i don't know how to call them.
Thanks.
0
 
LVL 2

Expert Comment

by:bkdc
ID: 6460225
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Knight_G
ID: 6460242
#include <windows.h>

void main()
{

     HANDLE StdOut = GetStdHandle(STD_OUTPUT_HANDLE);

     CONSOLE_CURSOR_INFO cursor = {50, true};
     SetConsoleCursorInfo(StdOut, cursor);


}


The following errors are found:
C2664: 'SetConsoleCursorInfo' : cannot convert parameter 2 from 'struct _CONSOLE_CURSOR_INFO' to 'const struct _CONSOLE_CURSOR_INFO *'


Pls help.
0
 
LVL 2

Accepted Solution

by:
bkdc earned 150 total points
ID: 6460256
GEee, I hink i've already answered your question, but hey, what the hell...

try this: SetConsoleCursorInfo(StdOut, &cursor);
sorry, no compiler 50m around me so....you're on your own

anyway, it should work.

Really,really desperate solution:
 CONSOLE_CURSOR_INFO *stuff;
 stuff->....
 SetConsoleCursorInfo(StdOut, stuff);








0
 

Author Comment

by:Knight_G
ID: 6460563
There is no error now, but there is no effect when i change
the value of dwSize and bVisible.
0
 
LVL 2

Expert Comment

by:bkdc
ID: 6460733
does the SetConsoleCursorInfo function fail? Check to see what it returns (true/false)
0
 

Author Comment

by:Knight_G
ID: 6460847
Yeah, it working now!
You help me learn so much

A million thanks on ur help!!!!
0
 
LVL 2

Expert Comment

by:bkdc
ID: 6461352
live long and prosper :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question