<p>We have an application which needs to use Direct3D. Specifically, it needs at least DirectX 9.0c version 4.09.0000.0904. While this should be present on all newer XP machines it might not be installed on older XP machines. How can I programmatically (using C++) determine if it is installed? I want to be able to give an information message to the user that Direct3D will not be available.</p>

[{'answer_id': 79801, 'author': 'Adam Mitz', 'author_id': 2574, 'author_profile': 'https://Stackoverflow.com/users/2574', 'pm_score': 0, 'selected': False, 'text': '<p>According to the DirectX 9.0 SDK (summer 2004) documentation, see the GetDXVer SDK sample at \\Samples\\Multimedia\\DXMisc\\GetDXVer.</p>\n'}, {'answer_id': 79817, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 4, 'selected': True, 'text': '<p>Call DirectXSetupGetVersion: <a href="http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.directsetup.directxsetupgetversion" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.directsetup.directxsetupgetversion</a></p>\n\n<p>You\'ll need to include dsetup.h</p>\n\n<p>Here\'s the sample code from the site:</p>\n\n<pre><code>DWORD dwVersion;\nDWORD dwRevision;\nif (DirectXSetupGetVersion(&amp;dwVersion, &amp;dwRevision))\n{\n    printf("DirectX version is %d.%d.%d.%d\\n",\n           HIWORD(dwVersion), LOWORD(dwVersion),\n           HIWORD(dwRevision), LOWORD(dwRevision));\n}\n</code></pre>\n'}, {'answer_id': 79887, 'author': 'kooshmoose', 'author_id': 7436, 'author_profile': 'https://Stackoverflow.com/users/7436', 'pm_score': 0, 'selected': False, 'text': '<p>A quick Google search turns up <a href="http://www.codersource.net/win32_registry_operations.html" rel="nofollow noreferrer">this article</a> which identifies the location of the version number in the registry and then provides a case statement which maps the internal version number to the version number we\'re more familiar with.</p>\n\n<p>Another quick Google search turns up an example in C++ for <a href="http://www.codersource.net/win32_registry_operations.html" rel="nofollow noreferrer">reading from the registry</a>.</p>\n\n<p>Enjoy...</p>\n'}, {'answer_id': 1141111, 'author': 'legalize', 'author_id': 139855, 'author_profile': 'https://Stackoverflow.com/users/139855', 'pm_score': 0, 'selected': False, 'text': '<p>Yes, use the mechanism shown in the DirectX Install sample in the March 2009 DirectX SDK.  (Look under "System" category in the sample browser.)</p>\n\n<p>Do not use the registry!  That stuff is undocumented and not guaranteed to work.</p>\n\n<p>The only supported way is to use the DirectSetup API, which is shown in the DirectX Install sample.  I also cover this stuff in Chapter 24. Installation and Setup in my book <a href="http://www.xmission.com/~legalize/book/download/" rel="nofollow noreferrer">The Direct3D Graphics Pipeline</a>.  You can download that chapter for free at the above URL.</p>\n'}]
['https://Stackoverflow.com/questions/79745', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5022/']