Solved

Detect DirectX Version - How?

Posted on 1997-08-13
3
3,723 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
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
davmarc earned 270 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…

685 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