5

I need to run a service interactively on my computer.
(I am already aware of the implications.)

How do I enable a service (running in session 0) to run interact with the current desktop in Windows 7?

user541686
  • 23,663
  • 46
  • 140
  • 214

2 Answers2

5

As of Windows Vista, there are no directly interactive services. "Allow service to interact with desktop" is basically just a legacy option, although if you use it UI0Detect should pop up and allow you to switch to a special desktop to interact with the service.

This article describes some options. If you have further questions, I suggest you ask at Stack Overflow as this is a programming problem.

Harry Johnston
  • 5,754
  • 7
  • 30
  • 55
  • Note that as of Windows 7, the UI0Detect service is not started by default. If you need to access legacy interactive services, you may wish to change the configuration for UI0Detect to start automatically. – Harry Johnston Mar 25 '14 at 00:48
  • 1
    ...and as of Windows 10 version 1803, the Interactive Services Detection Service (ui0detect) service no longer exists: https://www.coretechnologies.com/blog/windows-services/interactive-services-removed-windows-10/ – Kim Aug 21 '20 at 12:24
1

As long as it is designed correctly, go under services.msc and check the box:

enter image description here

surfasb
  • 22,452
  • 5
  • 52
  • 77
  • It says "Please enter a valid password". Also, wouldn't the privileges be pretty limited here? – user541686 Apr 22 '12 at 02:47
  • Depends on what you are doing. . . What are you trying to do anyways? and what is the service? – surfasb Apr 22 '12 at 08:23
  • It's a program I made for my own use. It needs system privileges, but like I said, that's a secondary worry. The primary worry is that this doesn't even work, since it's asking me for a password. – user541686 Apr 22 '12 at 09:23
  • Services.msc is asking for a password? Select Local System account. Sorry, that SS is confusing I guess. – surfasb Apr 22 '12 at 18:06
  • Yea it asks for a password. If I say Local System account then it still can't interact though (even when I check the box, UI0Detect pukes at me). – user541686 Apr 22 '12 at 18:09
  • How did you write this application? C# or C++? Which Win32 classes are you calling? There are certain contracts you have to follow. That is probably why the OS is puking at you. Normally, NO ONE writes a service that interacts with the desktop, because the desktop doesn't yet exist at startup and a service can run at any time. People usually write a service and then write a separate UI program to interact with the service. – surfasb Apr 22 '12 at 18:19
  • C++. So you're saying this isn't possible? – user541686 Apr 22 '12 at 18:30
  • I'm saying that using the service to call UI object which may not exist is the buggy way to do things. – surfasb Apr 22 '12 at 20:13
  • 2
    "Allow service to interact with desktop" is a legacy option, as of Windows Vista it no longer works. – Harry Johnston Apr 23 '12 at 05:47
  • @HarryJohnston: I remember reading something similar, but didn't bother to find it. Just making sure I wasn't going crazy. – surfasb Apr 24 '12 at 01:29