SaveSetting and GetSetting are the most commonly used. They are limited in scope, however. Here is an example of reading a registry key using a copy of the Registry APIs. For more examples, down load the free API Viewer from http://www.allapi.netVB Code:
Private Const HKEY_CURRENT_USER = &H80000001 Private Const HKEY_LOCAL_MACHINE = &H80000002 Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegQueryValueEx Lib "advapi32.dll" 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 Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Sub Command1_Click() Dim Result As Long Dim KeyRet As Long Dim KeyToRead As String Dim KeyValue As String Dim Length As Long Result = RegOpenKey(HKEY_CURRENT_USER, "Software\KPD-Team\APIViewer 2001\", KeyRet) KeyToRead = "MSDN" Result = RegQueryValueEx(KeyRet, KeyToRead, 0, 0, "", Length) KeyValue = Space$(Length - 1) Result = RegQueryValueEx(KeyRet, KeyToRead, 0, 0, ByVal KeyValue, Length) MsgBox KeyValue RegCloseKey KeyRet End Sub




Reply With Quote