NOPz
asked on
Windows Console Programming Problem
I am trying to code a HideCursor() function.Iread the MSDN i thought
I knew what to do ..but it turns out my function does not work.
This is how i implemented it.
void System::HideCursor(void)
{
HANDLE Console = GetStdHandle(STD_OUTPUT_HA NDLE);
CONSOLE_CURSOR_INFO CursorInfo;
char buffer[10]={0};
CursorInfo.bVisible=false;
CursorInfo.dwSize=0;
SetConsoleCursorInfo(Conso le,&Cursor Info); // HERE OCCURS THE ERROR, THE FUNCTION FAILS
}
But it does absolutely nothing.Do not waste time dubugging.
I traced the error and it seems to be System Error 87 : The Parameter is Incorect.
Now why is this happening.I even tried the more radical solution
...that is using a CONSOLE_CURSOR_INFO *CursorInfo. The function failed in that case too.
Please help me find a solution.Thank you!
Somehow, the printf() and cout<< functions don't appear to work in this environment.anybody have an
idea on this?
I knew what to do ..but it turns out my function does not work.
This is how i implemented it.
void System::HideCursor(void)
{
HANDLE Console = GetStdHandle(STD_OUTPUT_HA
CONSOLE_CURSOR_INFO CursorInfo;
char buffer[10]={0};
CursorInfo.bVisible=false;
CursorInfo.dwSize=0;
SetConsoleCursorInfo(Conso
}
But it does absolutely nothing.Do not waste time dubugging.
I traced the error and it seems to be System Error 87 : The Parameter is Incorect.
Now why is this happening.I even tried the more radical solution
...that is using a CONSOLE_CURSOR_INFO *CursorInfo. The function failed in that case too.
Please help me find a solution.Thank you!
Somehow, the printf() and cout<< functions don't appear to work in this environment.anybody have an
idea on this?
According to the MSDN documentation for CONSOLE_CURSOR_INFO, the dwSize member must be between 1 and 100 (apparently inclusive). Try setting it to 1 instead of 0. :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I tried it after fixing the bad param and sure the cursor did disappear.