Einzelnen Beitrag anzeigen

dR4g0N
(Gast)

n/a Beiträge
 
#8

Re: Problem mit ShellExecute (Parameter)

  Alt 11. Mai 2004, 08:32
big thx an dich. hab es jetzt anders gelöst bekommen. und zwar habe ich von swiss delphi .. diesen source für eine shellexecute and wait procedure, womit es klappt.

Delphi-Quellcode:
procedure ShellExecute_AndWait(FileName: string; Params: string);
var
  exInfo: TShellExecuteInfo;
  Ph: DWORD;
begin
  FillChar(exInfo, SizeOf(exInfo), 0);
  with exInfo do
  begin
    cbSize := SizeOf(exInfo);
    fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
    Wnd := GetActiveWindow();
    ExInfo.lpVerb := 'open';
    ExInfo.lpParameters := PChar(Params);
    lpFile := PChar(FileName);
    nShow := SW_SHOWNORMAL;
  end;
  if ShellExecuteEx(@exInfo) then
    Ph := exInfo.HProcess
  else
  begin
    ShowMessage(SysErrorMessage(GetLastError));
    Exit;
  end;
  while WaitForSingleObject(ExInfo.hProcess, 50) <> WAIT_OBJECT_0 do
    Application.ProcessMessages;
  CloseHandle(Ph);
end;
  Mit Zitat antworten Zitat