DirectX Initialization Problem

I'm so sorry if this is in the wrong section.

My problem is that this line of code keeps failing:

d3d = Direct3DCreate9 ( D3D_SDK_VERSION );
if ( !d3d )
MessageBox ( hWnd, L"CGraphics::Initialize failed on Direct3DCreate9() ", L"Error!" , NULL );
return false;

if this helps solve the problem, this is inside a function of a class, and the original definition of d3d is also in that class, which I coded so:


I keep getting my failure message box, and I cannot figure out why it keeps failing. I have searched the internet, and my initialization method appears to be the same as all the others that I have seen.


  • Well, there aren't many reasons why this should fail.

    Check that you have DirectX version 9.0c(use DxDiag). If you do, then make sure the versions of the DirectX header files you are using match the library files you are linking against(d3d9.h/d3d9.lib), which means they should both be from the same SDK package(you'll probably want the DirectX SDK August 2009 version).

    If that doesn't help, then see if other DX9 applications also fail, in which case reinstalling DirectX 9 or the video card drivers might work.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion