how do I run one DX9 program from another one in fullscreen? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how do I run one DX9 program from another one in fullscreen?

arkon3arkon3 Posts: 1Member
Hi Guys,

I have a big problem with my DX9 project. I have an executable that runs DX9 fullscreen, it all works fine. When the user clicks on an icon I need to start a new executable running fullcreen, also DX9.

My problem is that when the 1st program releases it's DX9 devices ready for the next exe to take over the screen, the new exe gets a DEVICELOST error when creating the device. It's like the 1st exe doesn't actually release the dx device. Here is my code snippits if it will help.

In both exe's I create the devices thus:-

d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
d3d9->GetDeviceCaps(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,&caps);
if(caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
vp = D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
vp = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

ZeroMemory(&pp,sizeof(pp));
pp.BackBufferWidth = xs;
pp.BackBufferHeight = ys;
pp.BackBufferFormat = D3DFMT_A8R8G8B8;
pp.BackBufferCount = 1;
pp.MultiSampleType = D3DMULTISAMPLE_NONE;
pp.MultiSampleQuality = 0;
pp.SwapEffect = D3DSWAPEFFECT_DISCARD;
pp.hDeviceWindow = mainwindow;
pp.Windowed = windowed;
pp.EnableAutoDepthStencil = true;
pp.AutoDepthStencilFormat = D3DFMT_D24S8;
pp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
if(windowed)
pp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
else
pp.FullScreen_RefreshRateInHz = 60;

pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;

hr = d3d9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, mainwindow,vp,&pp, &d3ddevice);

I shut the devices down thus:-

d3ddevice->Release();
d3d9->Release();

The error I get when the second exe tries to create it's devices is
sometimes: D3DERR_DEVICELOST, but sometimes D3DERR_NOTAVAILABLE

Any ideas?

Sign In or Register to comment.