Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
how do I run one DX9 program from another one in fullscreen?
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);
if(caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
vp = D3DCREATE_HARDWARE_VERTEXPROCESSING;
vp = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
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;
pp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
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:-
The error I get when the second exe tries to create it's devices is
sometimes: D3DERR_DEVICELOST, but sometimes D3DERR_NOTAVAILABLE