Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RegCreateKeyEx& Help Release is on tuesday
Message
From
21/12/1998 07:11:41
 
 
General information
Forum:
Visual Basic
Category:
Windows API functions
Miscellaneous
Thread ID:
00169081
Message ID:
00169316
Views:
19
>I am setting some keys in an app and I have run into a bit of a bottleneck. I have a key with TWO values. The first is a string and the second is a binary value. I need to be able to set the binary value portion of the key and to date it has been a real party killer.
>
>[Reg KEY]
>HKEY_USERS\Software\Microsoft\Windows\CurrentVersion\Internet Settings
>
>[Key Values]
>EnableAutodisconnect 0000 01 00 00 00
>
>[Key Values I need to have]
>EnableAutodisconnect 0000 00 00 00 00
>
What is the type of the registry value (REG_DWORD, REG_BIN, etc.)? The RegSetValueEx API call (The call needed to write a registry value, as opposed to creating a key) takes a type designator as the third argument. the C prototype for the RegSetValueEx call is:

LONG RegSetValueEx{
hKey hKey,
LPCSTR lpSubKey,
DWORD Reserved,
DWORD dwType,
CONST BYTE *lpData,
DWORD cbDATA
}

Open the registry key whose value you wish to set with RegOpenKey or RegCreateKey, then call RegSetValueEx using the HKEY returned by the open as the first argument, the string name of the key value as the second argument (in your case, EnableAutoDisconnect), a zero as the third argument, the correct type as a number as the fourth argument (probably REG_DWORD or REG_BIN; these are constants you can find in the MSDN docs or the C header file WINREG.H), a void pointer or byte pointer to the buffer containing the data you want written in the fifth argument (in your case, a buffer containing all zeros for a REG_BIN, or an integer 0 for a REG_DWORD), and the length of the data to write as the sixth argument.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform