DirectX

Moderators: Sephiroth
Number of threads: 126
Number of posts: 200

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
how do I run one DX9 program from another one in fullscreen? Posted by arkon3 on 14 Jan 2011 at 6:34 AM
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?




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.