CISA FotoGallery

Statistiche

Tot. visite contenuti : 927929
Home Articoli tecnici VBA Accedere ai Registri con funzioni di API di ACCESS

Accedere ai Registri con funzioni di API di ACCESS

Queste chiamate non sono documentate, ma sostituiscono egregiamente le chiamate API di Windows per l'accesso ai registri.
Consentono sia la lettura che la scrittura di Chiavi.

Di seguito l'elenco delle Costanti tipiche più usate:

Root keys predefinite
Public Const cHKEY_CLASSES_ROOT = &H80000000
Public Const cHKEY_CURRENT_USER = &H80000001
Public Const cHKEY_LOCAL_MACHINE = &H80000002
Public Const cHKEY_USERS = &H80000003
Public Const cHKEY_PERFORMANCE_DATA = &H80000004


Tipi di dato per le Key del registro
Public Const cREG_NONE = 0
Public Const cREG_SZ = 1
Public Const cREG_EXPAND_SZ = 2
Public Const cREG_BINARY = 3
Public Const cREG_DWORD = 4
Public Const cREG_DWORD_LITTLE_ENDIAN = 4
Public Const cREG_DWORD_BIG_ENDIAN = 5
Public Const cREG_LINK = 6
Public Const cREG_MULTI_SZ = 7
Public Const cREG_RESOURCE_LIST = 8
Public Const cREG_FULL_RESOURCE_DESCRIPTOR = 9
Public Const cREG_RESOURCE_REQUIREMENTS_LIS­T = 10


Errore restituito dal Registry
Public Const cAccErrRegKeyNotFound = -201
Public Const cAccErrRegValueNotFound = -202
Public Const cAccErrRegCantSetValue = -203
Public Const cAccErrRegSubKeyNotFound = -204
Public Const cAccErrRegTypeNotSupported = -205
Public Const cAccErrRegCantCreateKey = -206


Chiamate
Declare Function accRegGetVal Lib "msaccess.exe" Alias "#70" _
(ByVal hkeyRoot As Long, _
ByVal strSubKey As String, _
ByVal strValName As String, _
lpData As Any, _
ByVal lngMaxLen As Long) As Long

Declare Function accRegWriteVal Lib "msaccess.exe" Alias "#71" _
(ByVal hkeyRoot As Long, _
ByVal strSubKey As String, _
ByVal strValName As String, _
lpData As String, _
ByVal lngType As Long) As Long

Declare Function accRegGetValName Lib "msaccess.exe" Alias "#73" _
(ByVal hkeyRoot As Long, _
ByVal strSubKey As String, _
ByVal lngValue As Long, _
ByVal strValName As String, _
ByVal lngMaxLen As Long, _
lngType As Long) As Long

Declare Function accRegGetKeyInfo Lib "msaccess.exe" Alias "#72" _
(ByVal hkeyRoot As Long, _
ByVal strSubKey As String, _
lngSubKeys As Long, _
lngValues As Long) As Long

Declare Function accRegWriteKey Lib "msaccess.exe" Alias "#74" _
(ByVal hkeyRoot As Long, _
ByVal strSubKey As String, _
ByVal strClass As String) As Long

Declare Function accRegGetKey Lib "msaccess.exe" Alias "#75" _
(ByVal hkeyRoot As Long, _
ByVal strSubKey As String, _
ByVal lngSubKey As Long, _
ByVal strName As String, _
ByVal lngMaxLen As Long) As Long


@Alex