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

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

我正忙于 windows phone 8 应用程序,我想与我的桌面进行交互。

我有一个 SelfHosted WebApi,我的 phone posts 数据也是如此。如果我 运行 来自 Visual Studio 的服务,现在一切正常。我可以与桌面交互,但是一旦我安装了服务(使用 WIX),我就无法与桌面交互。

服务设置: 我以本地系统身份登录并选中了 "Allow service to interact with desktop"。

据我所见,我可以 post 向服务发送数据,但是一旦我 运行 下面一行。

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

它什么都不做。

任何帮助将不胜感激。

如果您使用 "Allow service to interact with desktop" 启动服务并不意味着您可以执行所有 "usual" 屏幕活动。实际上,您仅限于一组非常小的允许功能。详情请见https://msdn.microsoft.com/en-us/library/windows/desktop/ms683502.aspx

所以我最终制作了一个系统托盘应用程序。

Windows 服务(从 Windows Vista 开始)运行 在隔离会话(会话 0)中。这会阻止与桌面的任何交互,即使选中 "interact with desktop" 选项也是如此。我看不出有什么办法绕过这个限制