Einzelnen Beitrag anzeigen

Exceeder

Registriert seit: 29. Mai 2006
24 Beiträge
 
#11

Re: Neuer Prozess im Benutzermodus (wenn Quellprogramm asAdm

  Alt 22. Apr 2009, 09:06
Hallo nochmal,

also hier mal meine StartProcess Funktion und meine ShellExecute Funktion. Eventuell weiß ja jemand was man da verändern muss, damit man zum Ziel kommt.

Delphi-Quellcode:
function StartProcess(const Filename: string; WaitFor: Boolean;
  ShowWindow: Boolean = False): Boolean;
var
  StartInfo: TStartupInfo;
  ProcInfo: TProcessInformation;

begin
  try
    FillChar(StartInfo, SizeOf(TStartupInfo), #0);
    FillChar(ProcInfo, SizeOf(TProcessInformation), #0);

    StartInfo.cb := SizeOf(TStartupInfo);
    StartInfo.dwFlags := STARTF_USESHOWWINDOW;
    StartInfo.wShowWindow := Abs(Integer(ShowWindow));

    if CreateProcess(nil, PChar(Filename), nil, nil, False, NORMAL_PRIORITY_CLASS, nil, PChar(ExtractFileDir(Filename)), StartInfo, ProcInfo) then
    begin
      if WaitFor then
        WaitForSingleObject(ProcInfo.hProcess, INFINITE);
                                    
      CloseHandle(ProcInfo.hProcess);
      CloseHandle(ProcInfo.hThread);
      Result := True;
    end
    else
      Result := False;
  except
    Result := False;
  end;
end;
Delphi-Quellcode:
function MyShellExecute(const Filename: string; const Parameters: string = '';
  const Operation: string = 'open'; const ShowCmd: Integer = SW_SHOWDEFAULT): Boolean;
begin
  Result := ShellExecute(0, PChar(Operation), PChar(Filename), PChar(Parameters), PChar(ExtractFilePath(Filename)), ShowCmd) > 0;
end;
Exceeder
  Mit Zitat antworten Zitat