Good day! Created a service and an application in C #, the service starts the application when it starts. The service starts normally, the application also starts. But the application icon in the tray does not appear, although when you start the application not from the service, the icon in the tray is displayed normally. Both service and application - everything starts on behalf of the system. If someone faced this problem - please shed light on this topic.
|
1 answer
Try to tick the checkbox "Allow desktop interaction" in the service properties. By default, it is removed.
- I tried to tick "Allow interaction with the desktop", did not help either. The point is that when an application is launched from a service, it starts, but its graphic part is not displayed. - dmail1976
- I know that in Windows 7, the interaction of the service directly with the desktop is prohibited, but if I do it, not from the service, but from the application, it should work. - dmail1976
- Then try to run the application On behalf of the account. - ganouver
- Tried and on behalf of: LocalSystem, User, LocalService and just in case NetworkService. The process (application) starts exactly, is in the task manager, and its graphical display does not occur. - dmail1976
- The problem is that the service runs in a separate session (in the task manager, the Session Code column). When you start an application, no matter from which account it is running, the application is launched in the service session and, accordingly, cannot access the user session interface. To make this possible, the application itself from the service must be launched in a user session. I will not say now how this is done, you need to delve into the parameters CreateProcess, and not from C #, but in Win32. - ganouver
|