I'm trying to create a new binary value under the HKCU\Software\Microsoft\Internet Explorer\New Windows\Allow key. Unfortunately I am having some trouble. How do I create a new zero-length binary key?
I'm using this function which uses the RegCreateKeyEx in the AdvAPI32 API.
VB Code:
Public Function CreateNewKey(sNewKeyName As String, lPredefinedKey As Long) Dim hNewKey As Long 'handle to the new key Dim lRetVal As Long 'result of the RegCreateKeyEx function lRetVal = RegCreateKeyEx(lPredefinedKey, sNewKeyName, 0&, _ vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, _ 0&, hNewKey, lRetVal) RegCloseKey (hNewKey) End Function
And this is the code to use the function:
VB Code:
For i = 1 To 3 strValue = RegGetValue$(HKEY_CURRENT_USER, strSubKey, arrSites(i)) If strValue = "" Then frmMain.CreateNewKey strSubKey, HKEY_CURRENT_USER frmMain.SetKeyValue strSubKey, arrSites(i), "", 3 Else End If Next
Does this look like I'm doing it right?


Reply With Quote