Solved

How to get console cursor position using VC++?

Posted on 2001-09-06
9
1,521 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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 50 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

821 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