GeekIMU/4.Software/GeekIMUDriver 1.1/Src/MyCls.h

43 lines
1.3 KiB
C
Raw Normal View History

2024-11-09 21:39:20 +08:00
#include <windows.h>
void MyCls(HANDLE hConsole)
{
COORD coordScreen = { 0, 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>Ͻ<EFBFBD><CFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL bSuccess;
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;//<2F><><EFBFBD><EFBFBD><E6BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
DWORD dwConSize;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5>ַ<EFBFBD><D6B7><EFBFBD>
bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);//<2F><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
//PERR(bSuccess, "GetConsoleScreenBufferInfo");
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>Ŀ
//<2F>ÿո<C3BF><D5B8><EFBFBD><EFBFBD><EFBFBD><E4BBBA><EFBFBD><EFBFBD>
bSuccess = FillConsoleOutputCharacter(hConsole, (TCHAR)' ', dwConSize, coordScreen, &cCharsWritten);
//PERR(bSuccess, "FillConsoleOutputCharacter");
bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);//<2F><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
//PERR(bSuccess, "ConsoleScreenBufferInfo");
//<2F><><EFBFBD><EFBFBD><E4BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bSuccess = FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
//PERR(bSuccess, "FillConsoleOutputAttribute");
//<2F><><EFBFBD><EFBFBD><EAB7B5><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>Ͻ<EFBFBD><CFBD><EFBFBD><EFBFBD><EFBFBD>
bSuccess = SetConsoleCursorPosition(hConsole, coordScreen);
//printf("ok");
//PERR(bSuccess, "SetConsoleCursorPosition");
return;
}
inline void back2zero(void)
{
static HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
static COORD coordScreen = { 0, 0 };
SetConsoleCursorPosition(hStdOut, coordScreen);
}
inline void clrscr(void)
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
MyCls(hStdOut);
return;
}