   Converting DX8 to DX9
  Hello! I started DirectX with andypike's DX8 tutorial, but when I got a new computer I found out that the new DX SDK had removed the DX8 headers. So I am porting everything to DX9! I had hoped it would be a simple matter of changing 8's to 9's, but alas, it is not. The biggest problem I'm having is how to detect the display mode?Previously, I was using something like this (okay, exactly like this):D3DFORMAT CGame::CheckDisplayMode(UINT nWidth, UINT nHeight, UINT nDepth){UINT x;D3DDISPLAYMODE d3ddm;for(x = 0; x < m_pD3D->GetAdapterModeCount(0); x++) //~(0, d3ddm.Format){m_pD3D->EnumAdapterModes(0, x, &d3ddm); //~(0, d3ddm.Format, x, &d3ddm)if(d3ddm.Width == nWidth){if(d3ddm.Height == nHeight){if((d3ddm.Format == D3DFMT_R5G6B5) || (d3ddm.Format == D3DFMT_X1R5G5B5) || (d3ddm.Format == D3DFMT_X4R4G4B4)){if(nDepth == 16){return d3ddm.Format;}}else if((d3ddm.Format == D3DFMT_R8G8B8) || (d3ddm.Format == D3DFMT_X8R8G8B8)){if(nDepth == 32){return d3ddm.Format;}}}}}return D3DFMT_UNKNOWN;}Unfortunately in DX9 this doesn't work because you already need to know the display mode before you can even call this function! And that was the whole point!There is a pretty cool function IDirect3DSwapChain9::GetDisplayMode but unfortunately it's part of this thing called a "Swap Chain." What's that? Is there another way to do this?If I have any other problems I'll post 'em here, but this looks like the only irresolvable one.   
  Hi,I've just checked the documentation that comes with the October 2006 edition of the DirectX 9 SDK and I found this [cut'n paste]:========IDirect3D9::GetAdapterDisplayModeRetrieves the current display mode of the adapter.HRESULT GetAdapterDisplayMode(  UINT Adapter,  D3DDISPLAYMODE * pMode);ParametersAdapter [in] Ordinal number that denotes the display adapter to query. D3DADAPTER_DEFAULT is always the primary display adapter. pMode [in, out] Pointer to a D3DDISPLAYMODE structure, to be filled with information describing the current adapter's mode. Return ValuesIf the method succeeds, the return value is D3D_OK. If Adapter is out of range or pMode is invalid, this method returns D3DERR_INVALIDCALL.RemarksIDirect3D9::GetAdapterDisplayMode will not return the correct format when the display is in an extended format, such as 2:10:10:10. Instead, it returns the format X8R8G8B8. RequirementsHeader: Declared in D3d9.h. ========I hope this helps.Jon   ;  Um no, d3d8.h comes with the Oct' 2006 release.  DX8 libs and headers are there.   