简体   繁体   中英

Find “Allow service to interact with desktop” checked (in the service properties) of Windows Service

I use Capture Screen in windows services all of codes worked correctly in win form but in win service that return a black picture SO I search and find this and try to find "Allow service to interact with desktop" checked (in the service properties) but there isn't any property with that name. Is there any idea about it? how/where I can find it? I use Windows Server 2008 R2 SP1 and VS2010 and C#4 and if there isn't any property in this version how can I do?

That setting is a legacy setting that won't solve your problem. Starting from Vista your service does not have access to the interactive desktop and you will need to perform the screen capture from a standard app running on the interactive desktop.

You can use an IPC mechanism to communicate between your service and the desktop app. You can start this desktop app from a service but it's rather tricky to do, as explained here .

Checking the "Allow service to interact with desktop" just means you can call interactive API functions without error. You don't get access to the inreractive desktop. This issue all stems from changes introduced in Vista that mean services run in an isolated session, session 0.

To set this property you have to open the windows service managment, right click your service and open the properties. after that select the "log on" tab. when your service runs under local system you can select "Allow service to interact with desktop".

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM