Windows Console Programming Problem

Posted on 2003-03-10
Medium Priority
Last Modified: 2012-06-27
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_HANDLE);
     CONSOLE_CURSOR_INFO   CursorInfo;
     char buffer[10]={0};
     SetConsoleCursorInfo(Console,&CursorInfo); // 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?
Question by:NOPz
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
  • 2

Expert Comment

ID: 8108519
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. :)

Accepted Solution

DAnderson earned 200 total points
ID: 8108529
Easy: read again

here is the quote:

When a screen buffer's cursor is visible, its appearance can vary, ranging from completely filling a character cell to showing up as a horizontal line at the bottom of the cell. The dwSize member of the CONSOLE_CURSOR_INFO structure specifies the percentage of a character cell that is filled by the cursor. If this member is less than 1 or greater than 100, SetConsoleCursorInfo fails.


Expert Comment

ID: 8108556
I tried it after fixing the bad param and sure the cursor did disappear.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

777 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