0

Im developing an application that would detect the DirectX versions installed on my system. For example if DirectX 9 and DirectX 11 are installed on my system then my program must detect these installations and display the installed versions. But I've no idea on how to accomplish this

EDIT: I dont want to use dxdiag UI to detect the versions, I want my program to detect the versions. And all installed versions must be detected not just the one that is pre-installed with the OS or the highest level supported by the OS

Xlam
  • 133
  • 2
  • 11
  • Duplicate of https://stackoverflow.com/questions/22223859/find-out-directx-version – Dale Oct 07 '17 at 16:08
  • 1
    Such a program already exists on every Windows machine. Run dxdiag.exe to have a look-see. You can run it with the /x option to generate an .xml file instead. – Hans Passant Oct 07 '17 at 16:15
  • Microsoft doesn't provide API for doing so. You should refer to the post mentioned by @Dale_dale12 – Asesh Oct 07 '17 at 16:45
  • Possible duplicate of [Find out DirectX Version](https://stackoverflow.com/questions/22223859/find-out-directx-version) – Asesh Oct 07 '17 at 16:45
  • @Asesh The post mentioned by Dale_dale12 provides solution to detect the highest supported feature level and not all levels installed on the system. What if directx 9 and direct11 are installed, those codes would detect only DX11 and not DX9 as DX11 would be the highest supported or any other level that is the highest supported – Xlam Oct 07 '17 at 16:59
  • 1
    @Xlam Like I said there's no API to detect it. Vista comes with DirectX 10 which means DirectX 9 will be there too. Windows 10 comes DirectX 12 pre-installed which means DirectX 9 will be there too. You will have manually go through registry and files to detect them if you don't want to use feature levels – Asesh Oct 09 '17 at 05:11

1 Answers1

2

You'll most likely not be able to list all installed DirectX versions. I came across this interesting article in the support pages of the gaming platform called Steam:

Trying to manually check for the correct versions is extremely complicated because there are numerous files that must all be present and individual system configuration options like dll search paths complicate the situation. In addition, the dependencies and required checks may change in each new version of the D3DX runtime.

As mentioned by Hans Passant you can get the highest installed version by running dxdiag /x <output file> to generate an XML file containing various entries of your computer information, then parse or deserialize that file in your application.

Visual Vincent
  • 18,045
  • 5
  • 28
  • 75