Seite 1 von 1
QProcess unter Windows
Verfasst: 29. Februar 2008 17:01
von zer0
ich will Firefox mit Argumenten starten! Unter Linux hat das wunderbar funkioniert aber unter windows nicht:
Wie geht das ?
Verfasst: 29. Februar 2008 17:42
von TBerger
Weil deine Firefox.exe wohl nicht im Systempfad eingetragen ist, wie unter Linux. Wenn du einfach firefox in deiner Windows-Console (Start->Ausführen->cmd.exe) eingibst, wird wahrscheinlich die gleiche Fehlermeldung kommen. Du musst schon den ganzen Pfad angeben, oder eben das Firefox-Verzeichnis in den PATH aufnehmen.
Verfasst: 29. Februar 2008 18:08
von Christian81
Oder, wie vor zwei Tagen schonmal hier besprochen QDesktopServices benutzen...
Verfasst: 29. Februar 2008 18:21
von zer0
Ja also mit kompletten Pfad hab ich es natürlich auch schon probiert, da musst ich bei Windoof dann ja auch doppel Backslash machen damit er das rallt, aber trotz dessen startet er das nicht ! ich guck mir jetz mal QDesktopServices an !
Danke für eure Antworten !
Anfügen wollte ich noch, dass er beim Dialog ausführen, dass Kommando firefox versteht!
Verfasst: 3. März 2008 11:49
von zer0
Die Antwort ist der Richtige Aufruf des Firefox Browsers, oder eines anderen Programms! Windoof möchte das ganze gerne in Anführungszeichen.
Also so:
Code: Alles auswählen
QProcess::startDetached("\"C:\\Programme\\Mozilla Firefox\\firefox.exe\" www.qt-forum.de")
Verfasst: 3. März 2008 13:26
von macman
Das hat nichts mit Windows zu tun. Jedes Betriebssystem möchte die Parameter in Anführungszeichen, wenn Leerzeichen im Wert sind. Woher soll es sonst wissen, ob das ein oder mehrere Parameter sind?
Verfasst: 12. März 2008 16:05
von C167
wuerde es nicht auch reichen, die Methode
Code: Alles auswählen
bool QProcess::startDetached ( const QString & program, const QStringList & arguments, const QString & workingDirectory, qint64 * pid = 0 ) [static]
zu nutzen?
Qt4.4-tp1 hat geschrieben:Starts the program program with the arguments arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to live.
On Unix, the started process will run in its own session and act like a daemon. On Windows, it will run as a regular standalone process.
On Windows, arguments that contain spaces are wrapped in quotes.
The process will be started in the directory workingDirectory.
If the function is successful then *pid is set to the process identifier of the started process.