Solved

Detect DirectX Version - How?

Posted on 1997-08-13
3
3,715 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now