xeonchen
xeonchen

Reputation: 13

Direct3DCreate9Ex returns D3DERR_NOTAVAILABLE (0x8876086a) when running as Windows Service

For some reasons, I have to create D3D9 in my program, which is running as a service.

But I got D3DERR_NOTAVAILABLE for the following code:

ATL::CComPtr<IDirect3D9Ex> d3d9 = nullptr;
HRESULT hr = ::Direct3DCreate9Ex(D3D_SDK_VERSION, &d3d9);

And it works if it's not running in a service.

I saw someone success to do this by checking Allow service to interact with desktop in the Control Panel, but it doesn't work for me.

Is there any setting I have to mention?

Upvotes: 1

Views: 1654

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41077

In Windows Vista and later, Windows Services run in an isolated context (called 'session 0 isolation') to reduce threats from malware. In some cases, you can create a NULL device and possibly a WARP device, but Direct3D GPU access from a Windows Service is not available until Windows 8.

See KB 978635

Upvotes: 2

Related Questions