LSM 510
VBA Programming
LSM 510 META
Access to Windows API Function and external DLLs
Carl Zeiss
03/06
B 45-0021 e
5-5
Example:
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Declare Function RegOpenKeyEx _
Lib "advapi32.dll" Alias "RegOpenKeyExA" _
(ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, _
phkResult As Long) As Long
Public Declare Function RegCloseKey _
Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public 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 ' Note that if you declare the lpData parameter
as String, you must pass it By Value.
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const SYNCHRONIZE = &H100000
Public Const READ_CONTROL = &H20000
Public Const STANDARD_RIGHTS_READ = (READ_CONTROL)
Public Const KEY_QUERY_VALUE = &H1
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_NOTIFY = &H10
Public Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or
KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
Public Const REG_SZ = 1 ' Unicode null terminated string
Public Const ERROR_SUCCESS = 0&