PDA

View Full Version : Obtaining the DirectX version with Delphi



Harry Hunt
10-09-2004, 08:18 PM
I'm writing a small system info program right now (I'll release it here when it's done) and for that I wanted to write a function that returns the DirectX version number as a string. Sounds pretty easy but it actually isn't (if you know otherwise, let me know).
After looking around for some time I found an example program that came with the DirectX 9 SDK which basically tried two different methods to obtain the version number. The first method is to create an interface to DXDiag and obtain the version number from there, the second method is to check the version numbers of the DirectX DLL files.
Long story short, I began by translating the DXDiag C header file to Delphi, then I translated the sample program from the DirectX SDK and then I rewrote it to make it look more like Delphi and less like C.
So if you need to check the DirectX version number, you can download the header and example program here (http://turbo.gamedev.net/dxversion.zip). Of course it's open source so do with it whatever you like. If you're having problems, please let me know.

tux
11-09-2004, 01:52 AM
it works but in dxdiag.pas. line 31 it should read


DXDIAG_E_INSUFFICIENT_BUFFER = $8007007A;

not


DXDIAG_E_INSUFFICIENT_BUFFER = $8007007AL;

otherwise it wont compile :) (well in delphi 7)

Harry Hunt
11-09-2004, 07:36 AM
damn you copy'n paste!

Thanks.