mirror of
https://github.com/vapaamies/KolibriOS.git
synced 2025-09-21 02:30:07 +02:00
Project tree simplified
This commit is contained in:
36
Examples/GetCurrentDir/GetCurrentDir.dpr
Normal file
36
Examples/GetCurrentDir/GetCurrentDir.dpr
Normal file
@@ -0,0 +1,36 @@
|
||||
program GetCurrentDir;
|
||||
|
||||
uses
|
||||
KolibriOS;
|
||||
|
||||
const
|
||||
AppPath = PPKolibriChar(32);
|
||||
CmdLine = PPKolibriChar(28);
|
||||
|
||||
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, 'Test');
|
||||
|
||||
GetCurrentDirectory(Buffer, BUFFER_SIZE);
|
||||
|
||||
printf('AppPath is "%s"'#10, AppPath^);
|
||||
printf('CmdLine is "%s"'#10, CmdLine^);
|
||||
printf('CurrentDirectory is "%s"'#10, Buffer);
|
||||
|
||||
ConsoleExit(0);
|
||||
TerminateThread;
|
||||
end.
|
Reference in New Issue
Block a user