On 8 May 2006 at 11:15, David De Weerdt wrote:

> I'm wondering how I can accomplish the following:
> I want to use COM to start the GUI from a client process. So I have a
> COM-server process running that has a launch command which is called
> by the COM-client.
> 
> this launch command on the server basically looks like:
> 
> int launch(int argc, char** argv) {
>         FX::FXProcess myprocess(argc, argv);
>         FX::TnFXApp application("foo", "bar");
>         application.init(argc, argv);
>         MyThread primaryLoop(&application);
>         return application.run(primaryLoop);
> }
> 
> but of course this does not return until the application ends. What I
> want is that the primaryLoop starts (and thus starts the GUI), the GUI
> is kept running and that this launch function still returns.
> In the past I did this with putting the application.run method in an
> FXThread, but I can not do this in TnFOX anymore.
> 
> I think it is trivial what i want to do, but i cannot see how to do it :-)

What you could do, and I stress this will only work on Windows, is 
run the message pump for MyThread and just not bother for the main 
thread.

Therefore, you'd do everything you're doing except that instead of 
return application.run(primaryLoop), you'd invoke 
primaryLoop.start(true). This will cause launch() to return 
immediately, which means FXProcess will get destroyed along with 
TnFXApp.

Therefore you need to move those into static FXAutoPtr's so they 
persist as long as TnFOX code is running. You should then at some 
point before program termination but after the TnFOX code has 
finished destroy the TnFXApp and the FXProcess.

If you want some hints on how to do this, look at the code in 
Python/converters.cxx which has to temporarily instantiate a 
FXProcess when TnFOX is loaded into python as a module and then 
correctly deinitialise stuff when it gets kicked out of python. It 
uses FXPtrHold rather than FXAutoPtr, but the process is very 
similar.

Hope this helps.

Cheers,
Niall





-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Tnfox-discussion mailing list
Tnfox-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tnfox-discussion

Reply via email to