Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RegCreateKeyEx& Help Release is on tuesday
Message
From
23/12/1998 15:22:28
 
 
General information
Forum:
Visual Basic
Category:
Windows API functions
Miscellaneous
Thread ID:
00169081
Message ID:
00170069
Views:
16
>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
>
Actually, I have done the footwork and I have resolved the issue.

I am going to create an upload for the UT. But in the meantime here is the solution:

I had initialy used RegCreateKey, and RegSetKey but The multiple part key values were being a real pain in the 'tushka' I wound up using the 'Ex' keys almost exclusivly.

In my above values the correct way to describe what I wanted would have been like so:

Binary Data Name: "EnableAutoDisconnect" Binary Data Value: 00 00 00 00
The Code would look like this:
sDataName = "EnableAutoDisconnect"
sKeyName = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
sDataValue = &O0
lLen = Len(sDataValue)
ret& = RegOpenKeyEx(HKEY_USERS, sKeyName, 0, 0, lphKey&) 'lphKey is the keys handle
ret& = RegSetValueEx(lphKey&, sDataName, 0, REG_BIN, sDataValue, lLen) 'REG_BIN = 3 
ret& = RegFlushKey(lphKey&) ' Uncache the new data (Force immediate write)
To set a two-part string key use RegSetValueExString() otherwise you might need some asprin sooner than you like. :) I am currently working on the retrieval of the keys' information to be used in the app. When this is done I will release everything to the thread. :)
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Previous
Reply
Map
View

Click here to load this message in the networking platform