简体   繁体   English

Web Api 2服务(允许服务与桌面交互)

[英]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. 我正忙于要与桌面交互的Windows Phone 8应用程序。

I have an SelfHosted WebApi that my phone posts data too. 我有一个SelfHosted WebApi,我的手机也发布了数据。 Now everything works fine if i run the service from Visual Studio. 现在,如果我从Visual Studio运行服务,一切都会正常。 I can interact with the Desktop, but as soon as I install the service (using WIX) i cant interact with the desktop. 我可以与桌面进行交互,但是一旦安装了该服务(使用WIX),我便无法与桌面进行交互。

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); System.Windows.Forms.Cursor.Position =新的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. 有关详细信息,请参见https://msdn.microsoft.com/zh-cn/library/windows/desktop/ms683502.aspx

So I ended up making a system tray application. 因此,我最终制作了系统任务栏应用程序。

Windows services (from Windows Vista onwards) run in a isolated session (session 0). Windows服务(从Windows Vista开始)在隔离的会话(会话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 我看不到这种限制的任何方式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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