Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum

developerWorks

  


Registry code
Benedict R Poole 6.Dec.01 07:29 AM a Web browser
Domino Designer -- Other 5.0.8 Windows NT


Here we go... this is only tested in Win2000 Professional and 5.05 of the client, but see how you go...

(Declarations)

Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type

Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (Byval hKey As Long, Byval dwIndex As Long, Byval lpname As String, lpcbName As Long, Byval lpReserved As Long, Byval lpClass As String, lpcbClass As Long, lpftLastWriteTime As FILETIME) As Long

Declare Function RegSetValueEx& Lib "advapi32.dll" Alias "RegSetValueExA" _
(Byval hKey As Long, Byval lpValueName As String, Byval Reserved As Long, Byval _
dwType As Long, Byval lpData As String, Byval cbData As Long)

Declare Function RegCreateKey& Lib "advapi32.dll" Alias "RegCreateKeyA" (Byval _
hKey As Long, Byval lpSubKey As String, phkResult As Long)

Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (Byval hKey As Long, Byval lpSubKey As String, phkResult As Long) 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

Declare Function RegCloseKey Lib "advapi32.dll" (Byval hKey As Long) As Long

Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (Byval hKey As Long, Byval lpValueName As String, Byval lpReserved As Long, lpType As Long, Byval lpData As String, lpcbData As Integer) As Long

Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (Byval hKey As Long, Byval dwIndex As Long, Byval lpname As String, Byval cbName As Long) As Long

' // Constant definitions
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_PERFORMANCE_DATA = &H80000004
Const SYNCHRONIZE = &H100000
Const STANDARD_RIGHTS_READ = &H20000
Const STANDARD_RIGHTS_WRITE = &H20000
Const STANDARD_RIGHTS_EXECUTE = &H20000
Const STANDARD_RIGHTS_REQUIRED = &HF0000
Const STANDARD_RIGHTS_ALL = &H1F0000
Const KEY_QUERY_VALUE = &H1
Const KEY_SET_VALUE = &H2
Const KEY_CREATE_SUB_KEY = &H4
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_NOTIFY = &H10
Const KEY_CREATE_LINK = &H20
Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
Const KEY_EXECUTE = (KEY_READ)
Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))
Const ERROR_SUCCESS = 0&

' // Registry data types...
Const REG_NONE = 0 ' No value type
Const REG_SZ = 1 ' Unicode nul terminated string
Const REG_EXPAND_SZ = 2 ' Unicode nul terminated string
Const REG_BINARY = 3 ' Free form binary
Const REG_DWORD = 4 ' 32-bit number
Const REG_DWORD_LITTLE_ENDIAN = 4 ' 32-bit number (same as REG_DWORD)
Const REG_DWORD_BIG_ENDIAN = 5 ' 32-bit number
Const REG_LINK = 6 ' Symbolic Link (unicode)
Const REG_MULTI_SZ = 7 ' Multiple Unicode strings

Sub ReadRegistry(strPar As String, strValue As String)
%REM
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Title: sub ReadRegistry
Purpose: Given a key to look for, accesses local machine's Windows registry database and returns the value of
that registry key entry
Created by: Benedict Poole
Parameters: strPar parameter, containing the name of the variable to read from the registry
Returns: strValue parameter registry value
Testing: Lotus Notes 5.05 and Windows 2000 Professional
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
%END REM
Dim strKeyName As String
Dim lngKeyHandle As Long
Dim strName As String
Dim intBufferLength As Integer
Dim strBuf As String*256
Dim varResult1 As Variant
Dim varResult2 As Variant
intBufferLength = 256

' // Define the registry key we're after
strKeyName = "Software\Adobe\BLAH BLAH BLAH"

' // Open key by name
varResult1 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strKeyName , 0, KEY_QUERY_VALUE, lngKeyHandle)

' // If key is not opened, show the message and exit sub
If varResult1 <>ERROR_SUCCESS Then
Messagebox "Couldn't fined this key. Halting...", 0, "Error"
Exit Sub
End If

' // Get the variable value by name
varResult2 = RegQueryValueEx(lngKeyHandle, strPar, 0, REG_SZ , strBuf, intBufferLength)

' // Assign value to return variable. If the returned value contains zero bytes, only return that part of the
' // string before the first zero byte. Otherwise, trying to append anything to the string later will have problems
' // as many functions like Messagebox and Print treat the zero byte as the end of the string.
Dim intZero As Integer
intZero = Instr(strBuf, Chr(0))
If (intZero > 0) Then
strValue = Left(strBuf, intZero - 1)
Else
strValue = strBuf
End If
strValue=Fulltrim(strValue)

' // Close the key
Call RegCloseKey(lngKeyHandle)
End Sub



How to create a profile document (Talluri Rampras... 5.Dec.01)
. . RE: How to create a profile documen... (Benedict R Pool... 5.Dec.01)
. . . . RE: How to create a profile documen... (Talluri Rampras... 5.Dec.01)
. . . . . . RE: How to create a profile documen... (Benedict R Pool... 5.Dec.01)
. . . . . . . . RE: How to create a profile documen... (Talluri Rampras... 5.Dec.01)
. . . . . . . . . . Registry code (Benedict R Pool... 6.Dec.01)






  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search


 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

  Lotus Support
Lotus Support
Product support pages index
Search knowledge base (Technotes)
Search support downloads
Lotus Support RSS

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow