?
Solved

Detect DirectX Version - How?

Posted on 1997-08-13
3
Medium Priority
?
3,733 Views
Last Modified: 2013-12-03
I need to find out whether directX is installed on user's sytem and what version if any. My app requires DirectX2 or later. Virgin Interactive's Subspace program includes a small app called subcheck that does exactly what I'm desiring to do (http://www.subspace.vie.com). It reports directX version number (ie 1/2/3 etc.) and an additional version # (ie. DirectX 3 (version 4.04.00.0068)). I see no docs for doing this in DX3A SDK.

The method of doing CoCreateInstance of IDirectDraw2 to see if DX2 or later installed works but causes a DirectX systemwide failure to occur when my program restarts itself. (When user changes my program's preferences, I sometimes need to restart my program before they can be applied - I restart by executing my commandline (GetCommandLine) and then immediately terminating.) When I do the CoCreatInstance directx check at the start of my program, this restart sometimes causes directx to stop working for my program and all directx programs until system restarted. Therefore I'm interested in alternate methods of determining directX prescence/version.

btw, my current directx check is done like this:

CoInitialize
CoCreateInstance (IDirectDraw2)
if successful, I release object created
CoUninitialize

Thanks,
rob@cyberg8t.com
0
Comment
Question by:RobertM041397
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
davmarc earned 1080 total points
ID: 1404037
The following is an excerpt from KB article Q157730 "How to Determine Installed Version of DirectX":

To determine which version of DirectX is installed on your computer, follow these steps:
1.Using Windows Explorer or My Computer, locate the Ddraw.dll file in the Windows\System folder.

NOTE: If the Ddraw.dll file does not exist in the Windows\System folder, DirectX is probably not installed on your computer. 2.Use the right mouse button to click the Ddraw.dll file, and then click Properties on the menu that appears. 3.Click the Version tab. 4.Compare the version number on the File Version line with the following table:

      Version number   DirectX version
      --------------------------------
      4.02.0095               1
      4.03.00.1096            2
      4.04.00.0068            3

This is for users, but it's still indicative because it says where you should look for DirectX version.
So:
1) If ddraw.dll does not exist on user's Windows\System directory, you can assume that there is not DirectX installed.
2) If it exists, retrieve their version numbers through the APIs GetFileVersionInfo() and GetQueryValue().
3) Map the obtained DLL version number with DirectX version number, and you're done.

Davide Marcato.
0
 

Author Comment

by:RobertM041397
ID: 1404038
One more question: my app runs on both w95 and NT4, is ddraw.dll stored in same spot on NT machine?
0
 
LVL 4

Expert Comment

by:davmarc
ID: 1404039
That KB article was about Windows 95 and I cannot check under NT now - sorry :(

Davide Marcato.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question