Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DirectX Version Information 1

Status
Not open for further replies.

JAG14

Programmer
Joined
Sep 26, 2003
Messages
469
Location
GB
Hi All,

I have the need to know what DX Version is installed on my end-user's Computer and I simply can't find the information anywhere!

Google search is useless for probably the first time, and no forums i use seem to have the answer.

Do i need to reference a library or control, is it built in, or do I need to go and see Zeus on Olympus for the answer?

Any and all Help appreciated,
Virtual Pints for the answers!!!!

Thanks in advance.


jgjge3.gif


[tt]"Do not put off until tomorrow what you cannot put off until the day after tomorrow just as well." - Mark Twain[/tt]
 
A quick gander in my registry suggests:

HKLM\Software\Microsoft\DirectX\Version

My value is "4.09.00.0902" which is 9.0b

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"Why does my program keep showing error messages every time something goes wrong?"
 
You can also run dxdiag form the start/ run combobox.
 
vbrocks, Thanks, but I need to do it through code.

Andy, That seems like just the ticket. I'll keep this thread updated on different OS/DX Versions.

Anyone running a different Version of DX or on a Different OS, please post your version numbers from the registry key above and the corresponding version number you are actually running (using VBrocks suggestion)

Thanks all.


jgjge3.gif


[tt]"Do not put off until tomorrow what you cannot put off until the day after tomorrow just as well." - Mark Twain[/tt]
 
[tt]
Version Number DirectX Version

4.02.0095 DirectX 1.0
4.03.00.1096 DirectX 2.0 / 2.0a
4.04.0068 / 69 DirectX 3.0 / 3.0a
Never Released DirectX 4.0
4.05.00.0155 DirectX 5.0
4.05.01.1721 / 1998 DirectX 5.0 (Released with Windows 98)
4.06.02.0436 DirectX 6.0
4.07.00.0700 DirectX 7.0
4.07.00.0716 DirectX 7.0a
4.08.00.0400 DirectX 8.0
4.08.01.0810 /0881 DirectX 8.1
4.09.0000.0900 DirectX 9.0
4.09.0000.0901 DirectX 9.0a
4.09.0000.0902 DirectX 9.0b
[/tt]
 
Strongm,

A Bloody Huge Star for you good sir,

star.gif


Thank You Kindly



jgjge3.gif


[tt]"Do not put off until tomorrow what you cannot put off until the day after tomorrow just as well." - Mark Twain[/tt]
 
Additionally, instead of reading the registry, you could use the GetFileVersionInfo API call against DDRAW.DLL
 
Strongm,

How do I use this this API against the file, and would the returned values be the same as in your previous post?

Thx in advance.

jgjge3.gif
[tt]"Very funny, Scotty... Now Beam down my clothes."[/tt]
 
The following is partially based on an MS example, but with some major corrections...
[tt]
Option Explicit
Private Declare Function GetFileVersionInfo Lib "version.dll" Alias "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal dwHandle As Long, ByVal dwLen As Long, lpData As Any) As Long
Private Declare Function GetFileVersionInfoSize Lib "version.dll" Alias "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, lpdwHandle As Long) As Long
Private Declare Function VerQueryValue Lib "version.dll" Alias "VerQueryValueA" (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Long, puLen As Long) As Long
Private Type VS_FIXEDFILEINFO
dwSignature As Long
dwStrucVersion As Long ' e.g. 0x00000042 = "0.42"
dwFileVersionMSl As Integer ' e.g. 0x00030075 = "3.75"
dwFileVersionMSh As Integer
dwFileVersionLSl As Integer ' e.g. 0x00000031 = "0.31"
dwFileVersionLSh As Integer
dwProductVersionMSl As Integer ' e.g. 0x00030010 = "3.10"
dwProductVersionMSh As Integer
dwProductVersionLSl As Integer ' e.g. 0x00000031 = "0.31"
dwProductVersionLSh As Integer
dwFileFlagsMask As Long ' = 0x3F for version "0.42"
dwFileFlags As Long ' e.g. VFF_DEBUG Or VFF_PRERELEASE
dwFileOS As Long ' e.g. VOS_DOS_WINDOWS16
dwFileType As Long ' e.g. VFT_DRIVER
dwFileSubtype As Long ' e.g. VFT2_DRV_KEYBOARD
dwFileDateMS As Long ' e.g. 0
dwFileDateLS As Long ' e.g. 0
End Type

Private Type vbFileInfo
FileVersion As String
ProductVersion As String
End Type

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)



Private Sub Command1_Click()
Dim wombat As vbFileInfo

wombat = GetVersionInfo("c:\winnt\system32\kernel32.dll")
Beep
End Sub


Private Function GetVersionInfo(strPath As String) As vbFileInfo
Dim result As Long
Dim hHandle As Long
Dim hBuffer() As Byte
Dim myLen As Long
Dim myFileVersion As Long
Dim myFI As VS_FIXEDFILEINFO
Dim m_FileVer As String
Dim m_ProdVer As String

result = GetFileVersionInfoSize(strPath, hHandle)
ReDim hBuffer(result)
result = GetFileVersionInfo(strPath, hHandle, result, hBuffer(0))
result = VerQueryValue(hBuffer(0), "\", myFileVersion, myLen)
CopyMemory myFI, ByVal myFileVersion, Len(myFI)

m_FileVer = Format$(myFI.dwFileVersionMSh) & "." & Format$(myFI.dwFileVersionMSl, "00") & "."
If myFI.dwFileVersionLSh > 0 Then
m_FileVer = m_FileVer & Format$(myFI.dwFileVersionLSh, "00") & _
Format$(myFI.dwFileVersionLSl, "00")
Else
m_FileVer = m_FileVer & Format$(myFI.dwFileVersionLSl, "0000")
End If
'Debug.Print m_FileVer

m_ProdVer = Format$(myFI.dwProductVersionMSh) & "." & Format$(myFI.dwProductVersionMSl, "00") & "."
If myFI.dwProductVersionLSh > 0 Then
m_ProdVer = m_ProdVer & Format$(myFI.dwProductVersionLSh, "00") & _
Format$(myFI.dwProductVersionLSl, "00")
Else
m_ProdVer = m_ProdVer & Format$(myFI.dwProductVersionLSl, "0000")
End If
'Debug.Print m_ProdVer
GetVersionInfo.FileVersion = m_FileVer
GetVersionInfo.ProductVersion = m_ProdVer
End Function
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top