'引用windows scripting host object model
Private Sub Form_Load()
Dim regwsh, Value, DValue, temp As String
Set regwsh = New IWshShell_Class
DValue = regwsh.RegRead("HKLM\SOFTWARE\MICROSOFT\DirectX\InstalledVersion")
Value = regwsh.RegRead("HKLM\SOFTWARE\MICROSOFT\DirectX\Version")
For i = LBound(DValue) To UBound(DValue)
temp = temp & DValue(i)
Next i
MsgBox "您机器DirectX版本为 :" & vbCrLf & "DirectX " & Mid(temp, 4, 1) & "." & _ Right(temp, 1) & "(" & Value & ")"
Set regwsh = Nothing
End Sub