Link to home
Start Free TrialLog in
Avatar of evo_x
evo_xFlag for Romania

asked on

how to get the installed Directx version?

How can I get the installed DirectX version?

I use C++ and DX11

in the older versions of directx there was a utility sample which had a getdxversion function, but in DirectX 11 I can't find it anymore.
Avatar of sweetfa2
sweetfa2
Flag of Australia image

http://msdn.microsoft.com/en-us/library/bb757015.aspx

Applications developed in DirectX should not explicitly check to see which version of DirectX that they will be running under. In the past, assumptions about DirectX versions built into game code have caused failed installations. The DirectX version number that some applications read when setting themselves up changed between Windows Vista and prior Windows operating system releases.

Use DirectX Setup to configure DirectX on a user's machine. This allows code provided by Microsoft to perform any required version updates and detect or install any other necessary DirectX SDK components. Improper version checking can make an otherwise compatible game fail. Always launch DirectX Setup during installation (preferably using the /silent mode), as it will determine whether users need to update their DirectX files or not. See the "Installing DirectX with DirectSetup" topic in the DirectX 9 documentation for more details about configuring DirectX Setup.

Installations on Windows Vista should check to see that the latest versions of any files are installed. Shared files and system files should never be regressed during an installation. The version number of shared and system components are often updated when a version is released that expands functionality or fixes security problems. Overwriting these files will destroy that functionality and reintroduce those security vulnerabilities.
Avatar of evo_x

ASKER

I need to display the installed DirectX version for a system information utility.
Avatar of Member_2_5069294
Member_2_5069294

Microsoft DLLs usually have a version information resource.  The DirectX DLL's do, you can see it if you open the DLL as resources.  If you have the path to the DLLs you can use GetFileVersionInfo and VerQueryValue to read version information for display (this is what Dxdiag.exe does).

The concept of a version of DirectX is a bit wrong though.  There are many parts to DirectX and they can be at different versions.  Also the DLL version is not the same as the version DirectX is said to be at.  The DLL's on my PC are version 5.3 though I have DirectX 9 installed.

In theory there is no guarantee the version information will always be there.  Though I can't see MS removing it anytime soon.
ASKER CERTIFIED SOLUTION
Avatar of trinitrotoluene
trinitrotoluene
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of evo_x

ASKER

the getdxversion class was perfect since directx9, now how can I combine 3 methods ? to get an acurate result ?
if dxdiag uses getfileversioninfo then I should use that method, but how can I detect the latest version of directx? or maybe all and display all the installed versions.
It really depends on what you want the information for.

If the idea is to say 'You have Direct X Version ? Installed', then it looks like DirectXSetupGetVersion is the right answer.  If there is a need to know about more than the core components then use the GetFileVersionInfo.  I suppose you could do both, show the setup version and list the versions of the DLLs.

Trying to get the exact setup version from the DLL version info is complex and will fail in the future anyway.  There is no way to predict the correspondance between future DLL versions and setup versions.

As far as I know, its only possible to have one version of DX installed.  Someone could have a different version present on a drive, but not installed.  Versions of DX are tied with versions of Windows.
Avatar of evo_x

ASKER

getdxversion does it by trying to initialize COM objects which are avaiable only in certain versions of DX
I need the information to display it in a system info tool.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial