Chizl
asked on
Read/Write to registry in Binary (VB5)
I need to be able to read and write to registry in Binary with VB5. I know how to do Strings, Integers, Logicals, ect.
ASKER
I tested this and get back garbage. Again I need to write this as well. I relize it is binary, but I need to retrive this info and use it to place in other registries. For instance the program we are writing will need the registry entries of:
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\OLE, "DefaultAccessPermission" which is binary. I need to be able to store that and then write it to a different registy on a different computer.
HKEY_LOCAL_MACHINE\SOFTWAR
ASKER
I tested this and get back garbage. Again I need to write this as well. I relize it is binary, but I need to retrive this info and use it to place in other registries. For instance the program we are writing will need the registry entries of:
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\OLE, "DefaultAccessPermission" which is binary. I need to be able to store that and then write it to a different registy on a different computer.
HKEY_LOCAL_MACHINE\SOFTWAR
ASKER
Well that will not work.
Nothing prevents you from writing any value you want, write and read it, and interpit it however.
' Place some settings in the registry.
SaveSetting appname := "MyApp", section := "Startup", _
key := "Top", setting := 75
SaveSetting "MyApp","Startup", "Left", 50
GetSetting(appname := "MyApp", section := "Startup", _
key := "Left", default := "25")
' Place some settings in the registry.
SaveSetting appname := "MyApp", section := "Startup", _
key := "Top", setting := 75
SaveSetting "MyApp","Startup", "Left", 50
GetSetting(appname := "MyApp", section := "Startup", _
key := "Left", default := "25")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
RegOpenKeyEx to open the Registry
RegQueryValueEx to read the Value
RegCloseKey
RetVal = REgOpenKey(HKEY_LOCAL_MACH
RetVal = ReqQueryValueEx(hkey, "SourcePath",0, REG_SZ, ByVal Value, Len(Value))
RetVal = RegCloseKey(hkey)
msgbox "Your RegistryValue is : " & value
All defined in API-Viewer:
HKEY_LOCALMACHINE
REG_SZ -> String (Null-Terminated)
REG_BINARY -> Number
REG_DWORD -> Double
KEY_QUERY_VALUE
hkey is a long, it is a handle to your registry-key
For more details just ask...