Code:
Function IsDX7 as Boolean

   On Error Goto NoDX7
   Dim DirectX As New DirectX7

   IsDX7=TRUE
   Exit Function
NoDX7:
   IsDX7=FALSE
End Function
That should do it.