What I have to do to write DWORD Registry Values? There is a Method KeyType for RegistryItem but in the Documentation there is no hint where and how to implement this and within IDE this method does not show up. I have a method for writing registry values but my written values always end up as string values. I would like to use optional parameter namend “RegType” as KeyType but I do not know where I could set my RegItem. Could anybody help me out please? Thanx in advance!
Function WriteRegistry(Folder As String, Key As String, NewValue as Variant, optional RegType as Integer = 0) as Boolean
Dim myRegItem As RegistryItem
Dim found As Boolean = true
Dim elements(-1), path As String
try
elements = folder.split("\")
For i As Integer = 0 To Elements.Ubound
path = path + elements(i) + "\"
Try
myRegItem = New RegistryItem(path, True)
Catch err As RegistryAccessErrorException
found = False
Exit
End Try
Next
Finally
end try
If found And myRegItem <> Nil Then
// How to set DWORD Values ?
myRegItem.value(key) = NewValue
return true
Else
return false
End If
end function
If you parameter NewValue is being passed in via an integer type variable, then I would expect it to be stored as a dword ( assuming the reg. entry did not already exist as a string ).
In other words, what I see is…
dim myValyeInt as integer = 123
// Save as dword…
myRegItem.value(key) = myValueInt
dim myValueStr as string = “ABC”
// Save as string
myRegItem.value(key) = myValueStr