Issue with D3D9 and WS_EX_COMPOSITED

Started by
-1 comments, last by Rattrap 13 years, 2 months ago
I've been building my own C++ win32 wrapper. I wanted to start adding a Direct3D9 control to my library, so I started going through the D3D9 tutorials in the SDK. I did things slightly different from the example, creating a parent form first, then creating a child window within it that. The child window is what IDirect3DDevice9 is associated with. I included the following code in the message loop after the windows had been created.



// Error checking code removed for brevity. All are successful.

Direct3DDevice9->Clear( 0, 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(255,0,0), 1.0f, 0 );
Direct3DDevice9->BeginScene();
Direct3DDevice9->EndScene();
Direct3DDevice9->Present(0, 0, 0, 0);



IDirect3DDevice9 creation code


IDirect3DDevice9* Direct3DDevice9Raw(nullptr);
D3DPRESENT_PARAMETERS PresentationParameters;
ZeroMemory(&PresentationParameters, sizeof(D3DPRESENT_PARAMETERS));
PresentationParameters.Windowed = TRUE;
PresentationParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
PresentationParameters.BackBufferFormat = D3DFMT_UNKNOWN;
Result = Direct3D9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, WindowHandle, D3DCREATE_HARDWARE_VERTEXPROCESSING, &PresentationParameters, &Direct3DDevice9Raw);
if(Result != D3D_OK)
{
return -1;
}


The desired effect would be the child window would appear red, but I wasn't seeing anything. Everything had been initialized successfully. After some fiddling around, I discovered the culprit. My parent form uses the WS_EX_COMPOSITED extended window style. When i removed this, my red box shows up. Does anyone know if there is a way to get this to work, while keeping WS_EX_COMPOSITED on the parent form?

"I can't believe I'm defending logic to a turing machine." - Kent Woolworth [Other Space]

This topic is closed to new replies.

Advertisement