[SlimDX] Using DirectX 10 in a Windows Service

Started by
2 comments, last by GoodFun 15 years, 9 months ago
Heya, I have a pretty exotic question again for you guys... I'm trying to use DirectX 10 with SlimDX out of a Windows Service. I'm getting the following exception: {"DXGI_ERROR_NOT_FOUND: The item requested was not found. For GetPrivateData calls, this means that the specified GUID had not been previously associated with the object. (-2005270526)"} I don't seem to be getting a debug spew on this. The exception happens when I try to create the device...

_device = new D3D10.Device(D3D10.DeviceCreationFlags.Debug);
The service is running under Local System Account and 'Allow service to interact with desktop' is checked. I tried it without that box checked with the same result. My assumption is that DirectX is not available to a service, maybe one of you guys knows of a way to get around that. As for what my service does, it renders data into off screen textures and saves them to a memory stream. I'm not using a swap chain and hence no actual display. Things work fine when I use a Windows App, I was just hoping I could find a way to run this as a service to get around things like having to login to run the app or the app being closed by accident.
Advertisement
Offhand, I seem to recall that services by default run in their own little login session without access to the adapter, so you should expect to get the same kind of failures that you'd get if you didn't have a monitor connected at all. That looks to be the case here.

You may try configuring your service differently -- under the "Log On" tab in the service properties (Control Panel -> Administrative Tools -> Services -> right-click a service and choose Properties) you can alter the account used to execute the service and, in what looks to be most promising, click a checkbox that controls if the service can interact with the desktop. You can also mess with the hardware profiles the service belongs to.

Since this is a general DirectX concern, you may also consider posting to the DIRECTXDEV mailing list if what I suggested doesn't work and nobody else chimes in with a reasonable solution or explanation about how and why you can't do this.
It’s a know limitation of services that they can’t use Direct3D no matter how you configured them.
Thanks for the answers... I kinda was expecting this but one can hope right :)

This topic is closed to new replies.

Advertisement