cs_CanisLupus
Messages postés
3757
Date d'inscription
mardi 23 septembre 2003
Statut
Membre
Dernière intervention
13 mars 2006
21
21 mars 2005 à 11:23
Salut,
J'ai un code pour connaitre la version d'access installée mais je ne sais pas si ça marche pour un simple runtime. A voir.
'Dans un module
Public Const HKEY_CLASSES_ROOT = &H80000000
Private Const REG_SZ As Long = 1
Private Const ERROR_SUCCESS = 0&
Private Declare Function RegOpenKey _
Lib "advapi32" Alias "RegOpenKeyA" _
( _
ByVal hKey As Long, _
ByVal lpSubKey As String, _
phkResult As Long _
) As Long
Private Declare Function RegQueryValueEx _
Lib "advapi32" Alias "RegQueryValueExA" _
( _
ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
lpData As Any, _
lpcbData As Long _
) As Long
Public Function GetString(hKey As Long, strPath As String, strValue As String) As String
Dim Keyhand As Long, lValueType As Long
Dim strBuf As String, lDataBufSize As Long
Call RegOpenKey(hKey, strPath, Keyhand)
Call RegQueryValueEx(Keyhand, strValue, 0&, lValueType, ByVal 0&, lDataBufSize)
If lValueType = REG_SZ Then
strBuf = String(lDataBufSize, " ") 'init du buffer
If RegQueryValueEx(Keyhand, strValue, 0&, 0&, ByVal strBuf, lDataBufSize) = ERROR_SUCCESS Then
GetString = Split(strBuf, Chr$(0))(0)
End If
End If
End Function
et tu t'en sers comme ça :
Dim version As String
version = GetString(HKEY_CLASSES_ROOT, "Access.Application" & "\CurVer", "")
Loup Gris