(Gast)
n/a Beiträge
|
Re: *.bat Datei wird nicht richtig ausgeführt
11. Feb 2010, 17:33
Teste mal das:
Delphi-Quellcode:
{Execute batch file}
StrPCopy(Templine, 'temp.bat');
TaskHandle := ShellExecute(frmMain.Handle, NIL, 'command.com',
templine,
Tempdir,
SW_MINIMIZE);
//and monitor it with a function like this:
function CheckTask(hInstance: WORD): Boolean;
var
TaskInfo: TTASKENTRY;
RetVal: Boolean;
begin
TaskInfo.dwSize := SizeOf(TTASKENTRY);
RetVal := FALSE;
if(TaskFirst(@TaskInfo)) then
begin
repeat
if(TaskInfo.hInst = hInstance) then
begin
RetVal := TRUE;
Break;
end;
until (TaskNext(@TaskInfo) = FALSE);
end;
CheckTask := RetVal;
end;
(*This runs down the task list, trying to find the task with the specified
Hinstance, returning true if it is still there. To use this function,
simply call it in a loop like this*)
while CheckTask(TaskHandle) do
begin
Application.ProcessMessages;
end;
|
|
Zitat
|