Sign in to follow this  
helix

Detecting version of installed DX

Recommended Posts

helix    301
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

Share this post


Link to post
Share on other sites
SSJCORY    100
I think when u create the d3d interface IDirect3DCreate#(D3D_SDK_VERSION)
the D3D_SDK_VERSION is the version of directx they have?
-Cory

Share this post


Link to post
Share on other sites
helix    301
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. ;-)


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.

Share this post


Link to post
Share on other sites
DrunkenHyena    805
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this