• Advertisement
Sign in to follow this  

Detecting version of installed DX

This topic is 4589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
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
Sign in to follow this  

  • Advertisement