Method | Type | Description | Params |
|
|
|
|
CloseKey | SUB | Closes opened key | 0 |
CreateKey | FUNCTION (Key$) AS INTEGER | Creates a new key in CurrentPath. | 1 |
DeleteKey | FUNCTION (Key$) AS INTEGER | Deletes key. | 1 |
DeleteValue | FUNCTION (ValName$) AS INTEGER | Deletes a value data. | 1 |
KeyExists | FUNCTION (Key$) AS INTEGER | Returns 0 or 1 if key exists. | 1 |
KeyItem | FUNCTION (Index%) AS STRING | Retrieve the names of the subkeys | 1 |
MoveKey | FUNCTION (OldKey$, NewKey$, Delete%) | Moves existing key, subkeys, and data values. | 3 |
OpenKey | FUNCTION (Key$, CanCreate%) | CanCreate specifies whether to create the specified key if it does not exist. | 2 |
(*)ReadBinary | (*)FUNCTION (ValueName$, Index%) AS BYTE | Return binary value of specified key(Bug : Index must Start at -1) | 2 |
(*)ReadFloat | FUNCTION (ValueName$) AS DOUBLE | Return double value of specified key | 1 |
(*)ReadInteger | FUNCTION (ValueName$) AS INTEGER | Return integer value of specified key | 1 |
(*)ReadString | FUNCTION (ValueName$) AS STRING | Return string value of specified key | 1 |
RegistryConnect | FUNCTION (CompName$) AS INTEGER | Establishes connection to another computer's registry. | 1 |
RenameValue | (*)SUB (OldValueName$, NewValueName$) | Renames existing data value. | 2 |
ValueExists | FUNCTION (ValueName$) AS INTEGER | Returns 0 or 1 if data value Value$ exists. | 1 |
ValueItem | FUNCTION (Index%) AS STRING | Retrieve the names of the data values | 1 |
WriteBinary | (*)SUB (ValueName$, BYTE(), Size%) | Write Array of BYTEs in the specified key | 3 |
WriteFloat | (*)SUB (ValeName$, ValueData#) | Write double value in the specified key | 2 |
WriteInteger | (*)SUB (ValueName$, ValueData&) | Write integer value in the specified key | 2 |
WriteString | (*)SUB (ValueName$, ValueData$) | Write string in the specified key | 2 |
QRegistry Examples
' ---- EXAMPLE 1 (old)-----------
' Detect if your computer is connected to the internet
Const HKEY_LOCAL_MACHINE = &H80000002
DIM Registry AS QRegistry
Registry.RootKey = HKEY_LOCAL_MACHINE
Registry.OpenKey("System\CurrentControlSet\Services\RemoteAccess", 0)
'(index was 0 originally, but due to ReadBinary bug it must be -1)
IF Registry.ReadBinary("Remote Connection", -1) = 1 THEN
ShowMessage("You're connected!")
ELSE
ShowMessage("You're not connected!")
END IF
Registry.CloseKey '(*)
' ---- EXAMPLE 2 (new)-----------------
Const HKEY_CURRENT_USER = &H80000001
'
DIM Registry AS QRegistry
With Registry
.RootKey = HKEY_CURRENT_USER
' Write Key and Values
' --------------------
.OpenKey("TestToDelete", 1) ' Create Key if dont exist
.WriteInteger("MyInteger", 1234567890)
.WriteString ("Mystring", "1234567890")
DefByte MyBinary(10) = {1,2,3,4,5,6,7,8,9,0}
.WriteBinary ("MyBinary", MyBinary(), 10)
.CloseKey
' Read Values
' -----------
.OpenKey("TestToDelete", 1)
Print "MyInteger=";.ReadInteger("MyInteger")
Print " Mystring=";.ReadString ("Mystring")
DefInt N
For N = -1 To 8 ' This is a QREGISTRY 'bug' Binary index starts at -1
Print "MyBinary(";N")=";.ReadBinary ("MyBinary", N)
Next N
.CloseKey
' Delete the Key and all its Values
' ----------------------------------
.DeleteKey ("TestToDelete")
End With
' Exit Console
' ------------
DefStr sExit
Input " FINISHED CR to QUIT ", sExit
Application.Terminate
' -------------------------------------
(*) Lines corrected in april 2004