43 lines
1.3 KiB
C
43 lines
1.3 KiB
C
|
#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;
|
|||
|
}
|