I've created the window and I'm trying to initialize d3d in one of my projects. Here's the code I'm using:

#include <d3d9.h>
...

IDirect3D9 g_pD3D;
if (NULL == (g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)))
return E_FAIL;
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
if (FAILED(g_pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hw nd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&g_p d3dDevice)))
return E_FAIL;

I have all the directories set up correctly and I get the following errors:

main.cpp(40) : error C2259: 'IDirect3D9' : cannot instantiate abstract class
due to following members:
'HRESULT IDirect3D9::QueryInterface(const IID &,void ** )' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(232) : see declaration of 'IDirect3D9::QueryInterface'
'ULONG IDirect3D9::AddRef(void)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(233) : see declaration of 'IDirect3D9::AddRef'
'ULONG IDirect3D9::Release(void)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(234) : see declaration of 'IDirect3D9::Release'
'HRESULT IDirect3D9::RegisterSoftwareDevice(void *)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(237) : see declaration of 'IDirect3D9::RegisterSoftwareDevice'
'UINT IDirect3D9::GetAdapterCount(void)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(238) : see declaration of 'IDirect3D9::GetAdapterCount'
'HRESULT IDirect3D9::GetAdapterIdentifier(UINT,DWORD,D3DADA PTER_IDENTIFIER9 *)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(239) : see declaration of 'IDirect3D9::GetAdapterIdentifier'
'UINT IDirect3D9::GetAdapterModeCount(UINT,D3DFORMAT)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(240) : see declaration of 'IDirect3D9::GetAdapterModeCount'
'HRESULT IDirect3D9::EnumAdapterModes(UINT,D3DFORMAT,UINT,D 3DDISPLAYMODE *)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(241) : see declaration of 'IDirect3D9::EnumAdapterModes'
'HRESULT IDirect3D9::GetAdapterDisplayMode(UINT,D3DDISPLAYM ODE *)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(242) : see declaration of 'IDirect3D9::GetAdapterDisplayMode'
'HRESULT IDirect3D9::CheckDeviceType(UINT,D3DDEVTYPE,D3DFOR MAT,D3DFORMAT,BOOL)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(243) : see declaration of 'IDirect3D9::CheckDeviceType'
'HRESULT IDirect3D9::CheckDeviceFormat(UINT,D3DDEVTYPE,D3DF ORMAT,DWORD,D3DRESOURCETYPE,D3DFORMAT)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(244) : see declaration of 'IDirect3D9::CheckDeviceFormat'
'HRESULT IDirect3D9::CheckDeviceMultiSampleType(UINT,D3DDEV TYPE,D3DFORMAT,BOOL,D3DMULTISAMPLE_TYPE,DWORD *)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(245) : see declaration of 'IDirect3D9::CheckDeviceMultiSampleType'
'HRESULT IDirect3D9::CheckDepthStencilMatch(UINT,D3DDEVTYPE ,D3DFORMAT,D3DFORMAT,D3DFORMAT)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(246) : see declaration of 'IDirect3D9::CheckDepthStencilMatch'
'HRESULT IDirect3D9::CheckDeviceFormatConversion(UINT,D3DDE VTYPE,D3DFORMAT,D3DFORMAT)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(247) : see declaration of 'IDirect3D9::CheckDeviceFormatConversion'
'HRESULT IDirect3D9::GetDeviceCaps(UINT,D3DDEVTYPE,D3DCAPS9 *)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(248) : see declaration of 'IDirect3D9::GetDeviceCaps'
'HMONITOR IDirect3D9::GetAdapterMonitor(UINT)' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(249) : see declaration of 'IDirect3D9::GetAdapterMonitor'
'HRESULT IDirect3D9::CreateDevice(UINT,D3DDEVTYPE,HWND,DWOR D,D3DPRESENT_PARAMETERS *,IDirect3DDevice9 ** )' : pure virtual function was not defined
C:\DXSDK\Include\d3d9.h(250) : see declaration of 'IDirect3D9::CreateDevice'
main.cpp(41) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'IDirect3D9 *' (or there is no acceptable conversion)
main.cpp(48) : error C2819: type 'IDirect3D9' does not have an overloaded member 'operator ->'
C:\DXSDK\Include\d3d9.h(229) : see declaration of 'IDirect3D9'
did you intend to use '.' instead?
main.cpp(48) : error C2227: left of '->CreateDevice' must point to class/struct/union
type is 'IDirect3D9'
did you intend to use '.' instead?


Can someone shed some light?

BTW: I'm using the Visual C++ Toolkit.