I'm trying my best to get into Direct3D by more or less just sifting through MSDN examples and the occasional online tutorial. I found this one for Direct3D 8: http://www.robertwrose.com/d3d/tutorial.html

It's pretty good all I've had to do so far is swap the 8's around for 9's and the occasional function call is different by one parameter, which is usually NULL anyway.

So anyway I'm here: http://www.robertwrose.com/d3d/tutorial3.html

Near the end where I draw the vertex buffer, I get an error trying to compile this:

Code:
// ...
g_pD3DDevice->SetVertexShader(D3DFVF_D3DVertex);
// ...
Error:

Code:
c:\Documents and Settings\lee\Desktop\d3d\d3d.cpp(165) : error C2664: 'IDirect3DDevice9::SetVertexShader' : cannot convert parameter 1 from 'int' to 'IDirect3DVertexShader9 *'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
So I tried this, which compiled:

Code:
    g_pD3DDevice->SetVertexShader(reinterpret_cast<IDirect3DVertexShader9 *> (D3DFVF_D3DVertex));
But then I get a runtime error when it reaches that call:

Code:
Unhandled exception at 0x4fe5831f in d3d.exe: 0xC0000005: Access violation writing location 0x0000004e.
In my other day to day programming I can get these quite a lot and usually have no trouble solving them (more often than not it's a pointer pointing somewhere it shouldn't be) but I can't figure out what's going wrong here.

D3DFVF_D3DVertex is the same #define from the tutorial page:

Code:
#define D3DFVF_D3DVertex (D3DFVF_XYZ | D3DFVF_DIFFUSE)
Tis madness, madness ah tells ya!