Enabling/Disabling Aero from a Windows Service

耗尽温柔 提交于 2019-12-02 05:46:41

I had the same error code, when creating WPF FlowDocuments through a service running under 64-bit Vista. After digging around I can accross this post on Microsoft Connect, which points out that

"... The problem is caused by an interop problem with the DWM ..."

and

"... it will fix the WPF crash in all services including IIS7 ..."

Here is the direct link to the hot-fix downloads; KB 959209

This fixed our problems with running unit tests through CruiseControl.Net (CCNet) running 64-bit Vista. The tests where fine when not running through a service.

I dont know for certain, but perhaps you need to associate your service's process with the current desktop before that will work?

Make sure that your service can interact with the desktop. Then use SetThreadDesktop() to set the desktop for the service thread passing in a handle to the desktop called "Default".

I haven't tried it, and I can't guarantee it'll work. But it might be something to try?

Good luck :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!