// Wenn Ihrem
selbstgeschriebenen Programm Dateinamen als Parameter program Project1;
uses
Windows, Forms, Classes, SysUtils,
Unit1 in 'Unit1.pas' {Form1};
{$R *.RES}
var
i: integer;
s, z: string;
sl: TStringlist;
mutexhandle: THandle;
function schonda: boolean;
begin
mutexhandle := CreateMutex(nil, false,
PChar('UNIQUE-String_DBR-Software_20.11.2011'));
result := GetLastError = ERROR_ALREADY_EXISTS;
end;
begin
s := paramstr(1);
for i := 2 to paramcount do begin
if copy(paramstr(i), 2, 2) = ':\'
then z := #13#10 else z := #32;
s := s + z + paramstr(i);
end;
sl := TStringlist.create;
sl.text := s;
if sl.count > 0 then begin
// --- machwas, z.B.: ---
i := 0;
while i < sl.count do begin
if not fileexists(sl[i])
then sl.delete(i)
else inc(i);
end;
// "sl" kann nun weiter verarbeitet werden
// ----------------------
end;
if not schonda
then begin // das Programm startet nur beim ersten mal
Application.Initialize;
Application.Title := 'Test';
Application.CreateForm(TForm1, Form1);
Application.Run;
end;
sl.free;
if mutexhandle <> 0 then closehandle(mutexhandle);
end.
|
Zugriffe seit 6.9.2001 auf Delphi-Ecke





