can not reset the direct3d device

Started by
24 comments, last by thuong 19 years ago
thanks

no, i do not release anything, i can not understand tranfer message in DirectX

my code:

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{

PeekMessage( &msg, NULL, 0U, 0U, PM_NOREMOVE );
while( WM_QUIT != msg.message )
{
if( d3dApp.m_bActive )
d3dApp.m_bGotMsg = ( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) != 0 );
else
d3dApp.m_bGotMsg = ( GetMessage( &msg, NULL, 0U, 0U ) != 0 );

if( d3dApp.m_bGotMsg )
{
// Translate and dispatch the message
if( hAccelTable == NULL || msg.hwnd == NULL ||
0 == TranslateAccelerator( msg.hwnd, hAccelTable, &msg ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
else
{
WaitMessage();
}


}
}

d3dApp is app use directx
Advertisement
Ok. I don't think the problem is in your WinMain function.

When I asked if you were releasing resources when the device is lost, you said you are not. A device reset will fail if you don't release the resources it is using first. Basically, unless your resources are created as D3DPOOL_MANAGED, then you need to release them on lost device and recreate them after reset. (That's an oversimplification, but a good rule of thumb.)
ok thanks

but if i create a independent window with DirectX(the same code) then not problem occur.
Let's worry about getting it to work before worrying about why it's different.
thanks
i can not
i try anything but can not reset device
can anybody help me?
thanks
have you created any textures or surfaces using D3DPOOL_DEFAULT? u need to release them before u call d3dDevice->Reset(), and after the reset, re-create them.
i do not create anything, i only create window and init directx, not draw anything.
i have parent window and child window(contain directx)
my app:

CMyD3DApplication d3dApp

d3dApp.Create(hInstance, parentWindow): create a child window with parent window is parameter: parentWindow.
in this create funcion i have Init3DEnvirontment.
d3dApp.Render();

My Example the same D3DFrameWork of samples of SDK(microsoft)

i only to interface to call it in the other app.
U could goto control panel->directX, turn on the debug runtime. It will output the reasons why Reset() fails.
ok, thanks

This topic is closed to new replies.

Advertisement