No, you can't just pass in zero's to this function - or at least, that won't hide the cursor.
You probably need something like this:
I currently haven't got a setup to check if it works, but it should give you an idea of how it should be done. I'll leave it to you to implement "uhhideCursor".Code:bool hideCursor(void) { HANDLE hOut; CONSOLE_CURSOR_INFO cursInfo; hOut = GetStdHandle(STD_OUTPUT_HANDLE); if (hOut == INVALID_HANDLE_VALUE) { return false; } if (!GetConsoleCursorInfo(hOut, &cursInfo)) { return false; } cursInfo.bVisible = 0; if (!SetConsoleCursorInfo(hOut, &cursInfo) { // Error can't set cursor info. return false; } }
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
wow.. I haven't learnt bool yet..
I just pasted it and got errors
121 to 125Code:In function `bool hideCursor()': 121 koper.cpp expected `)' before '{' token 125 koper.cpp expected primary-expression before '}' token 125 koper.cpp expected `;' before '}' token
I wonder why it's error because GetConsoleCursorInfo doesn't error..Code:if (!SetConsoleCursorInfo(hOut, &cursInfo) { // Error can't set cursor info. return false; } }
> if (!SetConsoleCursorInfo(hOut, &cursInfo) {
Is missing a )
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
There probably needs to be a "return true;" at the end of the function too.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.