Detecting version of installed DX

Started by
3 comments, last by DrunkenHyena 18 years, 10 months ago
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
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
Favorite Quotes:Gandalf: You cannot pass!|Smeagol: We don't need you!|Sloth: Hey you guys!|
You can use DirectXSetupGetVersion().


jfl.
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.
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.
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement