telemark
May 9th, 2003, 08:05 AM
i'm running a printing system which dispatches print output from a business application to many different printers throughout the dpeartement. to make this process indpendent from the application itself (and to avoid time consuming printouts to block the app), this was implemented as a DCOM Service which provides a simple Object for all apps that want to print.
With this, I encountered two problems:
- if the Service runs under System account, it will never get access to network printers
- if it runs under different accounts, there is no opportunity to make it interactive with the desktop to display progess or error information
so i decided to put the main processing in an extra exe file and let the service call that exe with a different user account, which works quite good.
(i found some free code which allows to log on a user and give that user the right to access the current desktop)
but now it happens that about every 60 to 70 Prints, a workstation totally blocks and has to be restarted to work again.
i then get Error#1816 on one of the api calls in "setwinstadesktopsecurity" (i'm still in process to figure out which one exact)
has anyone an idea about what could be wrong in that code or if there is some system bug about this, and if so, how it can be bypassed?
i'll attach the code of the CLaunchMe class which is used to start the external process.
the service starts a thread for each print job, launches the print exe and waits for its termination. launching occurs inside a critical section to serialize all output - otherwise there are some problems with the database used - but it seems this has no effect on my error 1816
With this, I encountered two problems:
- if the Service runs under System account, it will never get access to network printers
- if it runs under different accounts, there is no opportunity to make it interactive with the desktop to display progess or error information
so i decided to put the main processing in an extra exe file and let the service call that exe with a different user account, which works quite good.
(i found some free code which allows to log on a user and give that user the right to access the current desktop)
but now it happens that about every 60 to 70 Prints, a workstation totally blocks and has to be restarted to work again.
i then get Error#1816 on one of the api calls in "setwinstadesktopsecurity" (i'm still in process to figure out which one exact)
has anyone an idea about what could be wrong in that code or if there is some system bug about this, and if so, how it can be bypassed?
i'll attach the code of the CLaunchMe class which is used to start the external process.
the service starts a thread for each print job, launches the print exe and waits for its termination. launching occurs inside a critical section to serialize all output - otherwise there are some problems with the database used - but it seems this has no effect on my error 1816