123456789101112131415161718192021 |
- #include <Windows.h>
- //------------------------------------------------------------------------------
- // Óñòàíîâêà êóðñóîðà è åãî ñêðûòèå - çàìåíà system("cls")
- //------------------------------------------------------------------------------
- void setCursorPosition(int x, int y)
- {
- static HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- static bool init = false;
- if (!init) { // ñêðûâàåì êóðñîð
- CONSOLE_CURSOR_INFO structCursorInfo;
- GetConsoleCursorInfo(hConsole, &structCursorInfo);
- structCursorInfo.bVisible = FALSE;
- SetConsoleCursorInfo(hConsole, &structCursorInfo);
- init = true;
- }
- COORD position = { x, y }; // óñòàíàâëèâàåì â íóæíóþ ïîçèöèþ
- SetConsoleCursorPosition(hConsole, position);
- }
- //------------------------------------------------------------------------------
|