Detecting version of installed DX
I need to display an error message and exit the game if the user only has DX8.0 installed as DX8.1 is the minimum requirement (this is a DX8 game -- not 9). I can't find any documentation that tells you how to do this and my game happily continues to run when all you have is 8.0. This causes problems with the rendering of the game (all messed up) so I can't allow them to play without upgrading their version to 8.1+.
Thanks for the help
I think when u create the d3d interface IDirect3DCreate#(D3D_SDK_VERSION)
the D3D_SDK_VERSION is the version of directx they have?
-Cory
the D3D_SDK_VERSION is the version of directx they have?
-Cory
Corey, that just specifies the version of the SDK you are using to compile, it doesn't actually get any information about the individual users. I had looked into that since it looked promising at first. ;-)
That's perfect, thanks. That beats what I was currently using.
edit: actually, now that I tried to run that bit of code, my app won't start because it can't find dsetup.dll. I guess I'll have to stick with my old hack-ish solution.
Quote:Original post by jflanglois
You can use DirectXSetupGetVersion().
jfl.
That's perfect, thanks. That beats what I was currently using.
// Determine the version of directx installed -- if less than 8.1, exit HKEY hRegKey = NULL; DWORD len = 256; unsigned long datatype = REG_SZ; static char dxversion[256]; if( ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\DirectX", 0, KEY_QUERY_VALUE, &hRegKey ) ) { RegQueryValueEx( hRegKey, "Version", NULL, &datatype, (LPBYTE)dxversion, &len ); RegCloseKey( hRegKey ); string version = dxversion; if( '0' == dxversion[2] && (dxversion[3] < '8' || ('8' == dxversion[3] && dxversion[6] < '1')) ) // Error Message }
edit: actually, now that I tried to run that bit of code, my app won't start because it can't find dsetup.dll. I guess I'll have to stick with my old hack-ish solution.
The SDK should have a Sample called GetDXVer which will give you what you're asking for.
It might be better to dynamically link to the DLL at runtime. It's less error-prone than version checking and still gives you what you need.
It might be better to dynamically link to the DLL at runtime. It's less error-prone than version checking and still gives you what you need.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement