Service related problem
-
I have a program (.exe):confused: that has GUI . Upon start this program places an icon in tray. I've made a service that starts the program befor login . It woks . It starts the program but i have some problems. If I login to a windows acount somtimes it doesen't place the icon in the tray. The TaskManger shows my program as beeing started by the SYSTEM account. If i logout an then login again it gets worst : i cannot logout or reset or shotdown windows . My guess is that this problem comes from the fact that when the service start the program it starts it using the "Winlogon" desktop and after login the desktop is changed to the "default" and then my program remains suspended in the "winlogon" desktop . I've try to change the tread desktop but it didn't work . Here is the code i've used HWINSTA oldWinSta = GetProcessWindowStation(); if (oldWinSta) { HWINSTA hWinsta = ::OpenWindowStation("WinSta0\\default", FALSE, MAXIMUM_ALLOWED); if (hWinsta) ::SetProcessWindowStation(hWinsta); } HDESK hDesk = ::OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP); SetThreadDesktop(hDesk); SetDesktop -- returns false; Can anyone help me? Does anyone knows why the windows doesen't respond at logoff, restart, shutdown if my program is started?