Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 don't succeed to.

i use the open function. itreturn success. but the Query and set binary fails...

 

10x,

  • Administrators
Posted

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?

 

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

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 didn't 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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...