By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,949 Members | 1,468 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,949 IT Pros & Developers. It's quick & easy.

Writing HEX value to Binary registry key

P: n/a
I'm trying to use the RegistryKey to write a hex number into the registry as
a binary type.

I know see that in DotNet, the RegistryKey tries to interprate what registry
type to create depending on the type of structure the variable was dimmed
as. I dimmed it as a character array, then dumped each value into that
character array, then wrote it to the registry and sure enough, it created a
binary entry of it .... but ....

The problem is that it wrote it to the registry as a bunch of numbers and
not as the HEX that I wanted. When I open up the registry, I want to see
hex numbers like: A3 FF 35 B3 56 and not: 33 55 123 54 56 22.

Does anyone know how to make the hex numbers show up in a binary key using
the RegistryKey?
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Steve!

you need to pass a byte array. you can use the System.BitConverter() class
to convert your value :
'***
Dim rk As RegistryKey = Registry.CurrentUser
rk = rk.CreateSubKey("Test")
rk.SetValue("binary", BitConverter.GetBytes(&HAAFF))
'***

--
Best Regards
Yanick

"Steve Bostedor" <ju**@tshore.com> a écrit dans le message de
news:%2****************@tk2msftngp13.phx.gbl...
I'm trying to use the RegistryKey to write a hex number into the registry as a binary type.

I know see that in DotNet, the RegistryKey tries to interprate what registry type to create depending on the type of structure the variable was dimmed
as. I dimmed it as a character array, then dumped each value into that
character array, then wrote it to the registry and sure enough, it created a binary entry of it .... but ....

The problem is that it wrote it to the registry as a bunch of numbers and
not as the HEX that I wanted. When I open up the registry, I want to see
hex numbers like: A3 FF 35 B3 56 and not: 33 55 123 54 56 22.

Does anyone know how to make the hex numbers show up in a binary key using
the RegistryKey?

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.