CRT unit with colored console example added

This commit is contained in:
2020-06-07 18:33:22 +03:00
parent ec5f97eecf
commit 69fbd69abc
13 changed files with 381 additions and 128 deletions

View File

@@ -1,7 +1,7 @@
program GetCurrentDir;
uses
KolibriOS;
KolibriOS, CRT;
const
AppPath = PPKolibriChar(32);
@@ -10,26 +10,16 @@ const
BUFFER_SIZE = 256;
var
hConsole: Pointer;
ConsoleInit: procedure(WndWidth, WndHeight, ScrWidth, ScrHeight: LongWord; Caption: PKolibriChar); stdcall;
ConsoleExit: procedure(bCloseWindow: Cardinal); stdcall;
printf: function(const Format: PKolibriChar): Integer; CDecl varargs;
Buffer: array[0..BUFFER_SIZE - 1] of Char;
begin
hConsole := LoadLibrary('/sys/lib/console.obj');
ConsoleInit := GetProcAddress(hConsole, 'con_init');
ConsoleExit := GetProcAddress(hConsole, 'con_exit');
printf := GetProcAddress(hConsole, 'con_printf');
ConsoleInit($FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, 'Get Current Directory');
ConsoleInit('Get Current Directory');
GetCurrentDirectory(Buffer, BUFFER_SIZE);
printf('AppPath is "%s"'#10, AppPath^);
printf('CmdLine is "%s"'#10, CmdLine^);
printf('CurrentDirectory is "%s"'#10, Buffer);
Write('AppPath is "%s"'#10, AppPath^);
Write('CmdLine is "%s"'#10, CmdLine^);
Write('Current Directory is "%s"'#10, Buffer);
ConsoleExit(0);
ConsoleExit(False);
end.