PDA

View Full Version : QProcess, child and setWorkingDirectory, for Windows process...



Nyphel
1st June 2007, 15:51
Hello :D !

I've a simple application that needs to launch Mozilla Firefox : that's OK.
The matter is that this application is called by Windows when the computer user clic on a mailto link : my application is the one defined in the system registry to be launched as default mail client.

So, when I'm clicking a mailto link on my favorite navigator (Mozilla Firefox), my application is launched and try to run Firefox (to set-up data in our Webmail message compose page). Like Firefox is already running, it should open a new tab for the Webmail... But not.

As said before, it's Windows that launch my application. So the application user isn't the computer user and isn't the current Mozilla Firefox user : another Mozilla Firefox process is launched by my application.

Is it possible to force the application to be run bu the current computer user ?
I've tried to use the QProcess:: setWorkingDirectory(QString) function to launch the application from it's real directory (in program files), but Windows crashed :p .

Thanks for your ideas and suggestions !

wysota
2nd June 2007, 18:03
I'm not sure what you mean... Even if Windows launches the application, it does it on behalf of the current user. I don't know if this is the case on Windows, but on Linux I can manipulate a running instance of Firefox through a small app that is bundled with the browser.

Isn't your problem that you form an endless loop between firefox and your app? When mailto: is called, your app i launched and it starts firefox and probably passes it the mailto: address, which again calls your app, etc.

Nyphel
2nd June 2007, 22:45
I think that works well : my application is launched only when the user clic the milto link.
I've controled it, and - lucky me - there is no such loop :)

I'm very interested in this small application you use : you can control Firefox ?!
Have you made this application, or is it coming with Firefox ?
If it comes with Firefox, what is the name of this application ?
What sort of control have you ?

In my case, if I launch my application manually, a new tab is open in Firefox.
If I launch it with a Batch script : the same.
If my application is launched by Windows : it's a new Firefox that is opened.

Moreover I've controled where the application is executed.
If I launch it, it's executed from its directory in C:/Program Files.
When Windows launch it, it's executed from a strange root disk M:///

Thanks for your answers, that really help me :)

wysota
3rd June 2007, 10:08
I'm very interested in this small application you use : you can control Firefox ?!
Yes, sort of.

Have you made this application, or is it coming with Firefox ?
It's part of Firefox distribution for Linux.

If it comes with Firefox, what is the name of this application ?
mozilla-xremote-client


What sort of control have you ?
You can open new windows and urls.

Nyphel
4th June 2007, 08:33
Ups...
That was only because I didn't gave arguments to my QProces Firefox.
If we don't give an argument (the URL to be opened), Firefox open a new window instead of opening a new tab in the current window.

:o