简体   繁体   中英

Web Api 2 Service (allow service to interact with desktop)

I am busy with a windows phone 8 application that i want to interact with my desktop.

I have an SelfHosted WebApi that my phone posts data too. Now everything works fine if i run the service from Visual Studio. I can interact with the Desktop, but as soon as I install the service (using WIX) i cant interact with the desktop.

The Service settings: I'm logged on as Local System and "Allow service to interact with desktop" is checked.

From what i can see is, i can post data to the service, but as soon as i run the following line.

System.Windows.Forms.Cursor.Position = new System.Drawing.Point(cursorX + deltaX, cursorY + deltaY);

It does not do anything.

Any help will be much appreciated.

If you start a service with "Allow service to interact with desktop" doesn't mean that you can do all "usual" screen activities. Actually you are limited to a very small set of functions which are allowed. Please see https://msdn.microsoft.com/en-us/library/windows/desktop/ms683502.aspx for details.

So I ended up making a system tray application.

Windows services (from Windows Vista onwards) run in a isolated session (session 0). This prevents any interaction with the desktop, even though the "interact with desktop" option is checked. I can't see any way around this limitation

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