QueryBinaryValue for registry

Eran

Member
Joined
Apr 12, 2003
Messages
69
Hi,

I am trying to use the APIs to read write to the registry:
QueryBinaryValue and SetBinaryValue to the first value in each key.
meaning.
lets asume i have the following path in my registry

HKEY_CLASSES_ROOT\*\shel\\Get Path\command
in Command i have the first key (Default). i want to Query and se valuse. in some reason i dont succeed to.
i use the open function. itreturn success. but the Query and set binary fails...

10x,
 
Does that registry key exist in your registry? (Do you mean shell not shel)?

Also why use the APIs when .Net provides classes to access the registry anyway?

Code:
Dim rk As Microsoft.Win32.RegistryKey

rk = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("*", True)
Dim b() As Byte
b = DirectCast(rk.GetValue("test"), Byte())
b(1) = 43
rk.SetValue("test2", b)

The value of test wsa added just for this sample.
 
PlausiblyDamp, 10x. i just realized i needed in order to get the value of the "(Default)" key, to set
"LPCTSTR pszValueName" parameter to "".

this is fine. the new problem is, that the Create method(which creates a new key, is not as straight forward as it seems.

i used it as followed:

Create(HKEY_CLASSES_ROOT,"*\\shell");
Now i get lots of compilation error. I searched the internet and saw that the implimintation of this api should be as followed:
Create(HKEY_CLASSES_ROOT,"CLSID\\{6270AEE4-AA41-11d4-A25D-008048B63F94}");

Now what is this I asked? Microsoft, in their help didnt talk about that. now i need to use the SetGUIDValue method. so... what the h... is going on here?

i just wanted to create new key for "HKEY_CLASSES_ROOT\*" which should be look like "HKEY_CLASSES_ROOT\*\shell"

If you have any idae, please help.
 
Code:
Dim rk As Microsoft.Win32.RegistryKey

rk = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("*", True)
rk.CreateSubKey("shell")
 
Back
Top