Thanks for your replies!
Konfusius: I tried using your code. The problem is that last parameter in CreateDevice function has to be a
IDirect3DDevice9 **
From the DirectX SDK Documentation:
HRESULT CreateDevice( UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS * pPresentationParameters, IDirect3DDevice9 ** ppReturnedDeviceInterface);
Trying to use your method
(
ATL::CComPtr<IDirect3DDevice9>& p_device
hr=p_d3d->CreateDevice(...,...,...,...,...,p_device);
)
fires a compile error.