home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / EASYREG.ZIP / ReadMe.txt < prev    next >
Encoding:
Text File  |  1998-02-28  |  7.9 KB  |  255 lines

  1.  
  2.              E A S Y R E G I S T R Y
  3.                                January 1998
  4.  
  5.  
  6. O.S.     : Windows 95, Windows NT
  7. Language : Visual Basic 5.0 (SP3)
  8. EASYREGISTRY.DLL Ver. 2.0.3
  9.          ActiveX Component
  10.          GlobalMultiuse
  11.          Multithread 
  12.          
  13.  
  14. 1.  Introduction
  15. 2.  Navigate Registry Keys
  16. 3.  Obtain Registry Keys listing
  17. 4.  Obtain Registry Values Names listing
  18. 5.  Manipulate Registry Values
  19. 6.  Manipulate Registry Keys
  20. 7.  Limitations
  21. 8.  Support
  22.  
  23.  
  24. -----------------
  25. 1.  Introduction
  26. -----------------
  27.  
  28. Are you looking for an EASY way to access System Registry ?
  29. System Registry is a hierarchically structured tree. Each node in the tree is
  30. called a KEY. Each key can contain both subkeys and data entries called 
  31. VALUES. 
  32. You can navigate the registry as DOS-like commands let you navigate 
  33. directories.
  34.  
  35. You need to register EasyRegistry.DLL with REGSVR32.EXE and then in your VB 
  36. program you have to add a reference to the DLL.
  37.  
  38. In EasyRegistry there are costants defined to make code more legible and 
  39. public Enum are defined to help coding. 
  40. Constant start with er... i.e. erByte.
  41.  
  42. --------------------------
  43. 2. Navigate Registry Keys
  44. --------------------------
  45.  
  46. Use CD method to navigate registry tree :
  47. - CD "\" 
  48.   set the root as the current key.
  49. - CD "<subkey name>"  
  50.   subkey <subkey name> (of the current key) became the current  key.
  51. - CD "\<key 1 name>\<key 2 name>\...\<key n name>" 
  52.   give a complete path to set the current key.
  53. - CD ".." 
  54.   Move up one level the current key.
  55.  
  56. So 
  57.  
  58. Dim Reg As New clsEasyRegistry
  59.   Reg.Cd "\HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\WINDOWS"
  60.   Reg.Cd ".."
  61.   Debug.Print Reg.CurrentKey
  62.  
  63. is the same of
  64.  
  65. Dim Reg As New clsEasyRegistry
  66.   Reg.Cd "\"
  67.   Reg.Cd "HKEY_CURRENT_USER"
  68.   Reg.Cd "SOFTWARE"
  69.   Reg.Cd "MICROSOFT"
  70.   Debug.Print Reg.CurrentKey
  71.  
  72.  
  73. --------------------------------
  74. 3. Obtain Registry Keys listing
  75. --------------------------------
  76.  
  77. DirKey function return a variant.
  78. It is Null if the current key has not any subkey.
  79. Otherwise it is an array of strings containing subkeys names. 
  80.  
  81. Dim Reg As New clsEasyRegistry
  82. Dim astrResult As Variant
  83. Dim lngJ As Long
  84.   Debug.Print Reg.CurrentKey
  85.   astrResult = Reg.DirKey
  86.   If Not IsNull(astrResult) Then
  87.     For lngJ = LBound(astrResult) To UBound(astrResult)
  88.       Debug.Print astrResult(lngJ)
  89.     Next
  90.   End If
  91.   Reg.Cd astrResult(LBound(astrResult))
  92.   Debug.Print Reg.CurrentKey
  93.  
  94.  
  95. ----------------------------------------
  96. 4. Obtain Registry Values Names listing
  97. ----------------------------------------
  98.  
  99. DirValue function return a variant.
  100. It is Null if the current key has not any value.
  101. Otherwise it is an array of strings containing values name, values type and 
  102. values in the current key.
  103.  
  104. Dim Reg As New clsEasyRegistry
  105. Dim astrResult As Variant
  106. Dim lngJ As Long
  107.   Reg.Cd "\HKEY_CURRENT_USER\INSTALLLOCATIONSMRU"
  108.   astrResult = Reg.DirValue
  109.   If Not IsNull(astrResult) Then
  110.     For lngJ = LBound(astrResult, 2) To UBound(astrResult, 2)
  111.       Debug.Print "Value Name : " & astrResult(erValueName, lngJ)      
  112.       Select Case astrResult(erValueType, lngJ)
  113.         Case erByte
  114.           Debug.Print "Value Type : " & "Byte"
  115.         Case erSTRING
  116.           Debug.Print "Value Type : " & "String"
  117.         Case erDWord
  118.           Debug.Print "Value Type : " & "DWord"
  119.       End Select      
  120.       Debug.Print "Value      : " & astrResult(erValue, lngJ)
  121.       Debug.Print
  122.     Next
  123.   End If
  124.  
  125. Value type can be STRING, BYTE or DWORD.
  126.  
  127.  
  128. ------------------------------
  129. 5. Manipulate Registry Values
  130. ------------------------------
  131.  
  132. ValueOf property set (and create) or get a value in the current key.
  133. DeleteValue method remove an existing  value from the current key.
  134.  
  135.  
  136. - ValueOf(<Value Name>,<Value Type>) = <Value> 
  137. SET a value in the current key.
  138.  
  139. <Value Name> is a string with the name of value in the current key (IN),
  140. <Value Type> is a long, can be set to erSTRING, erBYTE or erDWORD (IN),
  141. <Value> is the value <Value Name> of type <Value Type> (IN).
  142. If <Value Type> is erSTRING, then <Value> is a STRING,
  143. if <Value Type> is erBYTE  then <Value> is an array of BYTEs,
  144. If <Value Type> is erDWORD  then <Value> is a rounded DOUBLE (0..4294967295).
  145. N.B. if <Value Name> is not present in the current key it will be added.
  146.  
  147. Dim Reg As New clsEasyRegistry
  148. Dim abytBYTE(0 To 1) As Byte
  149.   Reg.Cd "\HKEY_CURRENT_USER\SOFTWARE\VB AND VBA PROGRAM SETTINGS"
  150.   Reg.ValueOf("NewValueName 1", erSTRING) = "Hello World !"
  151.   Reg.ValueOf("NewValueName 2", erDWord) = 666666666#
  152.   abytBYTE(1) = 100
  153.   abytBYTE(0) = 255
  154.   Reg.ValueOf("NewValueName 3", erByte) = abytBYTE
  155.  
  156.  
  157. - avntVariable = ValueOf(<Value Name>,<Value Type>)
  158. GET a value in the current key.
  159.  
  160. <Value Name> is a string with the name of value in the current key (IN),
  161. <Value Type> is a long, can be erSTRING, erByte or erDWord (OUT),
  162. avntVariable is an array of variant value returned (OUT),
  163. avntVariable(erStringFormat) is a formatted STRING,
  164. avntVariable(erByteFormat) is an array of BYTEs,
  165. avntVariable(erDWordFormat) is a rounded DOUBLE.
  166.  
  167. Dim Reg As New clsEasyRegistry
  168. Dim avntVariable As Variant
  169. Dim lngType As enmDataType
  170. Dim lngJ As Long
  171.   Reg.Cd "\HKEY_CURRENT_USER\SOFTWARE\VB AND VBA PROGRAM SETTINGS"
  172.   Reg.ValueOf("NewValueName 4", erDWord) = 4294967295#
  173.   avntVariable = Reg.ValueOf("NewValueName 4", lngType)
  174.   Select Case lngType
  175.     Case erByte
  176.       Debug.Print "Type : " & "Byte"
  177.     Case erSTRING
  178.       Debug.Print "Type : " & "String"
  179.     Case erDWord
  180.       Debug.Print "Type : " & "DWord"
  181.   End Select
  182.   Debug.Print "Value : " & avntVariable(erDWordFormat)
  183.   Debug.Print "Value (Hex) : " & avntVariable(erStringFormat)
  184.   Debug.Print "Value (Bytes) : "
  185.   For lngJ = LBound(avntVariable(erByteFormat)) To UBound(avntVariable(erByteFormat))
  186.     Debug.Print avntVariable(erByteFormat)(lngJ);
  187.   Next
  188.   Debug.Print
  189.  
  190.  
  191. - DeleteValue <Value Name>
  192. <Value Name> is a string with the name of value in the current key.
  193.  
  194. Dim Reg As New clsEasyRegistry
  195.   Reg.Cd "\HKEY_CURRENT_USER\SOFTWARE\VB AND VBA PROGRAM SETTINGS"
  196.   Reg.ValueOf("Temp Login Time",erSTRING) = "12:12.55"
  197.   Reg.DeleteValue "Temp Login Time"
  198.  
  199.  
  200. ----------------------------
  201. 6. Manipulate Registry Keys
  202. ----------------------------
  203.  
  204. MakeKey method add a new subkey in the current key.
  205. DeleteKey method delete an existing subkey in the current key.
  206. CurrentKey property return the current key.
  207.  
  208. Dim Reg As New clsEasyRegistry
  209.   Reg.MakeKey "Friends"
  210.   Reg.CD "Friends"
  211.   Debug.Print Reg.CurrentKey
  212.   Reg.MakeKey "Bimbo Gigi"
  213.   Reg.CD ".."
  214.   Reg.DeleteKey "Friends"
  215.  
  216. N.B.In Windows 95 DeleteKey recursively delete all subkeys of the current key,
  217.     in Windows NT DeleteKey can't delete a key that has subkeys.
  218.  
  219.  
  220. ----------------
  221. 7.  Limitations
  222. ----------------
  223.  
  224. If you find any bug or improvements to EasyRegistry please tell me, 
  225. that's why I'm sharing my work.
  226.  
  227. Only STRING, BYTE and DWORD values type are supported, anyway different data 
  228. types can be stored in the registry.
  229. So EasyRegistry can't be useful to write a REGEDIT-like application, you can
  230. use it with application that access well defined data types in the registry.
  231.  
  232.  
  233. -----------
  234. 8. Support
  235. -----------
  236.  
  237. If you discover any bug or improvements to EasyRegistry please tell me, 
  238. that's why I'm sharing my work.
  239. I'll correct any bug as soon as possible.
  240. Suggestions are welcome.
  241.  
  242. When EasyRegistry will be enough stable and error-free I'll release source 
  243. code to anyone will make request of it.
  244.  
  245. For any message about EasyRegistry e-mail me specifying "EASYREGISTRY" in the
  246. subject.
  247. ___________________________________________________
  248.  Luca Minudel                    software designer
  249.  Italy                             Conegliano (TV)
  250.  voice & fax                     +39 (0)438 412280
  251.  e-mail                      luca.minudel@nline.it
  252.  WWW                       (italian language used)
  253.  http://www.geocities.com/SiliconValley/Vista/4041
  254.  
  255.