CODE:#define STD_OUTPUT_HANDLE -11
#define windows_1251 1251
#define BLUE 1
#define GREEN 2
#define RED 4
#define FOREGROUND_INTENSITY 8
#define CYAN 3
#define MAGENTA 5
#define YELLOW 6
#define WHITE 7
#define CP_ACP 0
external(INT, "MultiByteToWideChar", "MultiByteToWideChar", "Kernel32.dll");
external(INT, "GetStdHandle", "GetStdHandle", "Kernel32.dll");
external(INT, "SetConsoleCP", "SetConsoleCP", "Kernel32.dll");
external(INT, "SetConsoleOutputCP", "SetConsoleOutputCP", "Kernel32.dll");
external(INT, "SetConsoleTextAttribute", "SetConsoleTextAttribute", "Kernel32.dll");
external(INT, "WriteConsole", "WriteConsoleA", "Kernel32.dll");
external(INT, "GetConsoleWindow", "GetConsoleWindow", "Kernel32.dll");
external(INT, "AllocConsole", "AllocConsole", "Kernel32.dll");
external(INT, "FreeConsole", "FreeConsole", "Kernel32.dll");
external(INT, "SetConsoleTitle", "SetConsoleTitleA", "Kernel32.dll");
external(INT, "SetCurrentConsoleFontEx", "SetCurrentConsoleFontEx", "Kernel32.dll");
external(INT, "MoveWindow", "MoveWindow", "User32.dll");
external(INT, "SetConsoleCursorInfo", "SetConsoleCursorInfo", "Kernel32.dll");
int CCI[2] = {1, 0}; // CONSOLE_CURSOR_INFO
string backspace = formatic(8)+formatic(8)+formatic(8);
string space = formatic(32)+formatic(32)+formatic(32);
int h_console = console_create(); // создать окно консоли
console_setfont(18); // установить размер шрифта
console_pos(200, 200, 400, 320); // переместить в координаты 200 200, изменить размер 400 320
console_setcolor(GREEN); // установить цвет текста
console_write("Какой-то текст^r^n"); // текст
console_write("Ещё текст^r^n"); // текст
console_setcolor(RED); // установить цвет текста
console_write("Ждём 5 секунд"); // текст
looptime(5000)
{
SetConsoleCursorInfo(h_console, address(#CCI[0])); // скрыть курсор
loop(3)
{
console_write("."); // текст
sleep(200);
}
console_write(backspace+space+backspace); // вместо последних 3х симвлов пишем пробел
pause(1000);
}
console_close(); //закрыть консоль
sleep(1);
function console_create()
{
FreeConsole();
AllocConsole();
SetConsoleTitle("log");
SetConsoleCP(windows_1251);
SetConsoleOutputCP(windows_1251);
return GetStdHandle(STD_OUTPUT_HANDLE);
}
function console_pos(int X, int Y, int nWidth, int nHeight)
{
MoveWindow(GetConsoleWindow(), X, Y, nWidth, nHeight, 1);
}
function console_write(string text)
{
char buffer[99999];
int written;
strcpy(#buffer[0], text);
WriteConsole(h_console, address(#buffer[0]), size(#buffer[0]), address(#written), 0);
}
function console_close()
{
FreeConsole();
}
function console_setcolor(int text_color)
{
SetConsoleTextAttribute(h_console, text_color + FOREGROUND_INTENSITY);
}
function console_setfont(int height_font)
{
string font_name = "Lucida Console";
int width_font = height_font/1.5;
char console_font_info[84];
initialarray(#console_font_info[0], 0);
writeaddress(84, address(#console_font_info[0]));
writeaddress(0, address(#console_font_info[4]));
writeaddress(width_font, address(#console_font_info[8])); // ширина шрифта
writeaddress(height_font, address(#console_font_info[10])); // высота шрифра
MultiByteToWideChar(CP_ACP, 0, font_name, size(font_name), address(#console_font_info[20]), 64);
SetCurrentConsoleFontEx(h_console, 0, address(#console_font_info[0]));
}