|
-
Sep 6th, 2000, 04:39 PM
#1
Thread Starter
New Member
Hello all!
I am trying to find out what is the best way to write binary (REG_BINARY) type values to the registry.
Say I have the following: 42, 41, 42, 41, 00, 31, 45, 46, 45, 00 (= BABA.1EFE.) and I would like to write all of that to the registry for a REG_BINARY type value.
Any ideas?? Any help would be GREATLY appreciated.
-
Sep 6th, 2000, 04:52 PM
#2
Use RegSetValueEx
Code:
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal HKEY As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal HKEY As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal HKEY As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Const HKEY_CURRENT_USER = &H80000001
Const REG_BINARY = 3
Sub SaveSettingEx(HKEY As Long, sPath As String, sValue As String, sData As String)
Dim KeyHand As Long
Call RegCreateKey(HKEY, sPath, KeyHand)
Call RegSetValueEx(KeyHand&, sValue, 0, REG_BINARY, ByVal sData, Len(sData))
Call RegCloseKey(KeyHand&)
End Sub
Private Sub Command1_Click()
SaveSettingEx HKEY_CURRENT_USER, "Software\BinaryTesting", "BinaryValue", "BABA.1EFE"
End Sub
-
Sep 6th, 2000, 05:30 PM
#3
Thread Starter
New Member
It worked!!
Thanks a whole bunch.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|