I try to run a demo of d3d9 in a windows 10 virtual machine only with a NVIDIA RTX 3090 card. This windows vm is connected via windows remote desktop. Here is my demo:
#include <Windows.h>
#include <d3d9.h>
#include <stdio.h>
int main() {
// sleep 5 seconds and manually minimize the remote desktop window immediately after the sleep operation
Sleep(5000);
IDirect3D9* pD3d9 = nullptr;
pD3d9 = Direct3DCreate9(D3D9b_SDK_VERSION);
UINT adapters = pD3d9->GetAdapterCount();
for (UINT i = 0; i < adapters; i++) {
D3DCAPS9 caps = {};
HRESULT res = pD3d9->GetDeviceCaps(i, D3DDEVTYPE_HAL, &caps);
if (FAILED(res)) {
printf("Call GetDeviceCaps Failed:%x\n", res);
break;
}
}
pD3d9->Release();
return 0;
}
GetDeviceCaps
return S_OK
when the remote desktop is a window or fullscreen mode. But, when running this demo in a minimized remote desktop, GetDeviceCaps
return a error code: D3DERR_NOTAVAILABLE
.
Does anyone know what is causing this call to fail?
Thanks!