Creating foreground tasks from background tasks

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Creating foreground tasks from background tasks

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:44 am

by Richard Greer >> Thu, 11 Nov 1999 22:28:34 GMT

Hi

We have a requirement to perform automatic printing, this printing service needs to be started when JadRap is started as a service. We cannot use a server application directly because this does not allow printing. An idea was to have a server app start up a jade client using the createExternalProcess method, but this seems to also start the jade client up as a background task (the startup form does not appear but there is a Jade.exe process running). When not running jadRap as a service this works fine.

Are we doing something wrong?, Does anyone know how to get around this problem?, or have another solution?, unfortunately we are stuck with using Jade 4.2.2

Thanks
Richard

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Creating foreground tasks from background tasks

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:44 am

by Krull >> Sun, 14 Nov 1999 20:42:31 GMT
We have a requirement to perform automatic printing, this printing service needs to be started when JadRap is started as a service. We cannot use a server application directly because this does not allow printing. An idea was to have a server app start up a jade client using the createExternalProcess method, but this seems to also start the jade client up as a background task (the startup form does not appear but there is a Jade.exe process running). When not running jadRap as a service this works fine.

Richard,

When you start a jade.exe from a service it inherits the 'service' attributes of the parent process. By default, a service is non-interactive, that is, it runs on a desktop that is not visible and cannot receive user input. I expect that you startup form has been created, you just can't see it on the logged on primary desktop. It sounds like you don't need to interact with this form, you shouldn't need to. Have you tried printing from a client running in this service lookalike mode? It might just work.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Creating foreground tasks from background tasks

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:44 am

by The_Swami >> Mon, 15 Nov 1999 4:07:41 GMT

Richard,

If you need to see the form for the app that does the printing then you could use the CreateProcess Windows API call. you can set it (via the lpStartUpInfo parameter) to whichever Desktop you like and also override the parameters that would normally be inherited from the parent process.

The Swami

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Creating foreground tasks from background tasks

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:44 am

by Krull >> Tue, 16 Nov 1999 1:36:23 GMT

Just some other random comments on this:

1) Ensure that the account your jade.exe is running under has the required print drivers configured. If you use the JADE createExternalProcess method to start jade.exe from the server, the account will be inherited from the JADE server service. The account can be configured in the service startup parameters.

2) You may require a means to shutdown the jade.exe 'print service' without logging off. You could manage this from an existing JADE foreground app using a user notification on a persistent object (or post a WM_QUIT message to a top level window using the PostMessage windows API if you are into that). An alternative would be to use the SVRANY app mentioned on the 'Thin Client Application Server as NT service' to manage the starting and stopping of jade.exe.

3) Another issue to be aware of when running jade.exe as a 'pseudo-service' in this fashion is that jade.exe honours the WM_QUERYENDSESSION and WM_ENDSESSION windows messages sent by Windows when a user logs off and will perform a normal shutdown whereas the JADE server service will keep running.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 32 guests