Skip to main content
gamedev.net
🔒 Locked

[ask] Execute external program

Started by mpek 1 reply 750+ views
Original Post
mpek
mpek
hello, currently i'm working on a game project that use directx and win32 api. here is the situation: i need to call an external program from my game ( a touchscreen calibrate utility ). i called the touchscreen calibrate program using win32 CreateProcess(). if i'm running my game in a windowed mode, it works ( calling the calibrate utility and then back into the game) but if i'm running my game in fullscreen mode, it doesn't work (calling the calibrate utility, and if i closed the app it won't go back to the game & shown DDerror surface lost)


DWORD WINAPI monitor_extprg_proc(LPVOID input){ 
     ...
     int retVal; 
     retVal = input->agent->ExecuteProcess(program,param);
     ...
} 
 
void Class::OnAction(Event event){ 
     ... 
     monitor_extprg_handle = CreateThread(NULL,0,monitor_extprg_proc,input,0,&id); 
     ... 
}


ExecuteProcess is an encapsulation of win32 api CreateProcess() i have an opinion maybe this is the same situation like alt+tab problem. CMIIW can someone give some sugestion ? thx before
IndyJones
IndyJones
Your device gets lost if your D3D fullscreen application looses its focus. This means you will have to release all D3DPOOL_DEFAULT resources, reset the device and recreate your resources. Usually your D3D rendering loop should look something like this:

HRESULT hr;if(SUCCEEDED(hr = d3dDevice->TestCooperativeLevel())){   // render your scene}else{   if(hr == D3DERR_DEVICELOST)   {       .. // release all D3DPOOL_DEFAULT resources like index/vertex buffers, textures, etc.       d3dDevice->Reset(&d3dPP); // reset needs presentation parameters       .. // recreate all D3DPOOL_DEFAULT resources   }}

Some of the D3DX interfaces also offer the OnLostDevice and OnResetDevice methods that do the release/recreate work for you.

HTH
mpek
mpek
@indy

errr, my engine still using LPDIRECTDRAWSURFACE3 to blit 2d.

i already check the DDERR_SURFACELOST, and i already changed the blit Function

res = m_pDDs->Blit(...);if( res == DDERR_SURFACELOST ){	m_pDDS->Restore();...


now after i called the external app, it can switch back to my game (no error) but it doesn't show anything just a black screen. can someone help me?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.