I am setting it to D3DDEVICETYPE_REF instead of D3DDEVICETYPE_HAL b/c my computer sux and its graphics car doesnt support HAL rendering...

I did some trial and error and found that the reason for the error was that the hWnd passed to the function was NULL... for some reason the CreateWindow function isnt working... But i causes no error????