En VB6 :
Option Explicit
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function GetCORVersion Lib "mscoree" (ByVal pbuffer As Long, ByVal cchBuffer As Long, dwlength As Long) As Long
Private Sub Command1_Click()
Dim vVer As String
If GetFrameworkVersion(vVer) Then
MsgBox "Framework .NET " & vVer, vbInformation
Else
MsgBox "Framework .NET n'est pas installé", vbInformation
End If
End Sub
Private Function GetFrameworkVersion(ByRef Version As String) As Boolean
Dim vSize As Long
Dim vHandle As Long
vHandle = LoadLibrary("mscoree.dll")
If vHandle Then
vSize = 256
Version = Space(vSize)
If (GetCORVersion(StrPtr(Version), vSize, vSize) = 0) Then
Version = Left$(Version, vSize - 1)
GetFrameworkVersion = True
End If
FreeLibrary vHandle
End If
End Function
@+
E.B.