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.net
VB Code:
  1. Private Const HKEY_CURRENT_USER = &H80000001
  2. Private Const HKEY_LOCAL_MACHINE = &H80000002
  3.  
  4. Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  5. 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
  6. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
  7.  
  8. Private Sub Command1_Click()
  9. Dim Result As Long
  10. Dim KeyRet As Long
  11. Dim KeyToRead As String
  12. Dim KeyValue As String
  13. Dim Length As Long
  14. Result = RegOpenKey(HKEY_CURRENT_USER, "Software\KPD-Team\APIViewer 2001\", KeyRet)
  15. KeyToRead = "MSDN"
  16. Result = RegQueryValueEx(KeyRet, KeyToRead, 0, 0, "", Length)
  17. KeyValue = Space$(Length - 1)
  18. Result = RegQueryValueEx(KeyRet, KeyToRead, 0, 0, ByVal KeyValue, Length)
  19. MsgBox KeyValue
  20. RegCloseKey KeyRet
  21. End Sub