unit SystemMacro;

interface

uses Windows, Messages, SysUtils, Classes;

function GetWinDir: string;
function GetSysDir: string;
function GetTempDir: string;
function IsKeyDown(i: Integer): Boolean;
procedure Pause(Application: TApplication; ms: LongInt);

implementation

function GetWinDir: string;
var p: PChar;

begin
p:=StrAlloc(261);
GetWindowsDirectory(p, 261);
Result:=p;
StrDispose(p);
end;

function GetSysDir: string;
var p: PChar;

begin
p:=StrAlloc(261);
GetSystemDirectory(p, 261);
Result:=p;
StrDispose(p);
end;

function GetTempDir: string;
var p: PChar;

begin
p:=StrAlloc(261);
GetTempPath(261, p);
Result:=p;
StrDispose(p);
end;

function IsKeyDown(i: Integer): Boolean;
var iskey: SmallInt;

begin
iskey:=GetAsyncKeyState(i);
result:=(HIBYTE(iskey)<>0);
end;

procedure Pause(Application: TApplication; ms: LongInt);
var stime: LongInt;

begin
stime:=GetTickCount;
while (GetTickCount-stime) <= ms do
Application.ProcessMessages;
end;

end.

Zurück zur Hauptseite