Einzelnen Beitrag anzeigen

wschrabi

Registriert seit: 16. Jan 2005
437 Beiträge
 
#16

AW: cmd.exe /c durch Shell Aufruf klappt unter WIN 10 nicht mehr

  Alt 29. Nov 2016, 07:00
hoika, das Shell Fenster geht ja gar nicht auf: Und ich ruf die app (= sqlite3.exe ) via folgendem Script auf, und das gibt true zurück.

Aufruf:
Delphi-Quellcode:
            WriteLogMemo(Format(' SHell: %s %s ',['c:\windows\system32\cmd.exe','/C '+ myapp +' '+uniconnection2.Database+' < '+gettempdirectory+'SQLIteIMportScript.txt']));
            exeRet:=StartandWait('c:\windows\system32\cmd.exe','/C '+ myapp+' '+uniconnection2.Database+' < '+gettempdirectory+'SQLIteIMportScript.txt');
Definition:
Delphi-Quellcode:
 
{******************************************************************************}
FUNCTION StartAndWait(CONST ExecuteFile, ParamString: STRING): boolean;
//http://delphi.about.com/library/weekly/aa040803a.htm
{******************************************************************************}
VAR
  SEInfo : TShellExecuteInfo;
  ExitCode : DWORD;
BEGIN
  Result := False;
  IF NOT FileExists(ExecuteFile) THEN Exit;
  FillChar(SEInfo, SizeOf(SEInfo), 0);
  SEInfo.cbSize := SizeOf(TShellExecuteInfo);
  WITH SEInfo DO
    BEGIN
      fMask := SEE_MASK_NOCLOSEPROCESS;
      Wnd := Application.Handle;
      lpFile := PChar(ExecuteFile);
      lpParameters := PChar(ParamString);
      nShow := SW_SHOWNORMAL;
    END;
  IF ShellExecuteEx(@SEInfo) THEN
    BEGIN
      REPEAT
        Application.ProcessMessages;
        // Damit die Prozessorauslastung sinkt :-)
        Sleep(100);
        GetExitCodeProcess(SEInfo.hProcess, ExitCode);
      UNTIL (ExitCode <> STILL_ACTIVE) OR Application.Terminated;
      Result := True;
    END;
END;
  Mit Zitat antworten Zitat