' Dans un module 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, lResult As Long Dim strBuf As String * 255 RegOpenKey hKey, strPath, Keyhand lResult = RegQueryValueEx(Keyhand, strValue, 0&, 0&, ByVal strBuf, 255) If lResult 0 Then GetString Split(strBuf, Chr$(0))(0) End Function ' Dans ta form Private Sub Form_Load() Dim s As String s = GetString(&H80000000, "Excel.Application\CLSID", "") s = GetString(&H80000000, "CLSID" & s & "\LocalServer32", "") s = Trim(Left$(s, InStr(1, s, "/") - 1)) MsgBox s End Sub
Private Sub Form_Load() Dim s As String s = GetString(HKEY_CLASSES_ROOT, "CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32", "") s = Trim(Left$(s, InStr(1, s, "/") - 1)) MsgBox s End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question