jrbleboss
Messages postés480Date d'inscriptionjeudi 6 mai 2004StatutMembreDernière intervention 3 septembre 2007
-
25 mars 2005 à 20:26
jrbleboss
Messages postés480Date d'inscriptionjeudi 6 mai 2004StatutMembreDernière intervention 3 septembre 2007
-
25 mars 2005 à 23:14
Bonjour,
Tou d'abord ne me dites pas d'aller voir les sorces car je les aient toutes vu ey ca marche toujours pas.
pourquoi ce code ne marche pas tout est déclaré etc...
cs_CanisLupus
Messages postés3757Date d'inscriptionmardi 23 septembre 2003StatutMembreDernière intervention13 mars 200621 25 mars 2005 à 22:03
Heu, je t'ai répondu sur un précédent post où tu posais la question avec wsh.
Alors, version avec API :
DANS UN MODULE Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const REG_SZ As Long = 1
Public Const ERROR_SUCCESS = 0&
Declare Function RegOpenKey _
Lib "advapi32" Alias "RegOpenKeyA" _
( _
ByVal hKey As Long, _
ByVal lpSubKey As String, _
phkResult As Long _
) As Long
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, " ")
If RegQueryValueEx(Keyhand, strValue, 0&, 0&, ByVal strBuf, lDataBufSize) = ERROR_SUCCESS Then
GetString = Split(strBuf, Chr$(0))(0)
End If
End If