-
September 11th, 2012, 01:56 PM
#1
Window won't display from service when run on Windows 7
I am debugging a Windows service that I need to run on Windows 7. The service was developed to display a window when it is running. (Yes, I know that isn't standard operating procedure.) The window displays without any problem when the service is run on older operating systems like XP or Server 2003, but on Windows 7 or Server 2008 it doesn't show up. There's an option whereby I can run the service as an application from the command line, and when I do that, the window displays. But as a service, nada. I've tried adding a call to ShowWindow() in the service, but that didn't fix it. Any ideas what's wrong here? Thank you.
-
September 11th, 2012, 02:10 PM
#2
Re: Window won't display from service when run on Windows 7
The Create() function in the service to create the window (a dialog) succeeds. I can't find any other Windows API calls made from the window pointer.
-
September 11th, 2012, 02:17 PM
#3
Re: Window won't display from service when run on Windows 7
"Allow service to interact with desktop" is checked on the Logon tab.
-
September 12th, 2012, 07:02 AM
#4
Re: Window won't display from service when run on Windows 7
I think I found an explanation to this. It took a while because I was looking for something described for Windows 7. But the change occured in the O/S before that, Windows Vista:
Services have always run in session 0. Before Windows Vista, the first user to log on was also assigned to session 0. Now, session 0 is reserved exclusively for services and other applications not associated with an interactive user session. (The first user to log on is connected to session 1, the second user to log on is connected to session 2, and so on.) Session 0 does not support processes that interact with the user.
This change means that a service cannot post or send a message to an application and an application cannot send or post a message to a service. In addition, services cannot display a user interface item such as a dialog box directly. A service can use the WTSSendMessage function to display a dialog box in another session.
-
September 17th, 2012, 07:39 AM
#5
Re: Window won't display from service when run on Windows 7
Originally Posted by mistemy
(Yes, I know that isn't standard operating procedure.)
It's more than just being non-standard. It was highly unrecommended for many years, at least since late 90's, when WinNT4 got spreading out.
Best regards,
Igor
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|