int main (void)
{
//Get a console handle
HWND myconsole = GetConsoleWindow();
struct CONSOLE_CURSOR_INFO
{
DWORD dwSize;
BOOL bVisible;
};
struct CONSOLE_CURSOR_INFO CURSOR;
CURSOR.bVisible = FALSE;
SetConsoleCursorInfo(myconsole, CURSOR);
}
I want to hide the cursor in Console, but failed.
What GCC-mingw32 reports are listed here:
error: request for member 'bVisible' in something not a structure or union
error: incompatible type for argument 2 of 'SetConsoleCursorInfo'
Could anyone help me?
Thanks.
#include <windows.h>
#include <wincon.h>
#include <stdio.h>
int main (void)
{
//Get a console handle
HANDLE myconsole = GetStdHandle(STD_OUTPUT_HANDLE);
/* It is already defined.
struct CONSOLE_CURSOR_INFO
{
DWORD dwSize;
BOOL bVisible;
};
*/
//CONSOLE_CURSOR_INFO is defined type.
CONSOLE_CURSOR_INFO CURSOR;
BOOL result;
CURSOR.dwSize = 1;
CURSOR.bVisible = FALSE;
result=SetConsoleCursorInfo(myconsole, &CURSOR);//second argument need pointer
if(result){//success
printf("test print\n");
getch();//wait
}
return 0;
}