wonderer
wonderer

Reputation: 3557

Reading and writing a key in/from the registry

Here's the problem.

I'm getting the following string as parameter to my function:

HKEY_CURRENT_USER\Software\MyProgram\SomeKey

where SomeKey is a

REG_DWORD

and has a value. I need to read and write to that key (SomeKey) but all the registry functions that I know take HKEY_CURRENT_USER separately from the rest of the key (\Software\MyProgram\SomeKey). Is there any API or function to pass the whole string and retrieve the value from that key? and to write a value to that key?

If not, anyone knows a good, fast way to do this?

thanks

Upvotes: 0

Views: 442

Answers (3)

Toby Allen
Toby Allen

Reputation: 11213

Wonderer the answer to your question as you have asked it, and provided rather unhelpful comments about, is no.

You will need to actually do some work, and actually write some codes since there is no build in API that will take a string you have written above and do what you ask. Microsoft have assumed that people would be willing to do that small little bit of code themselves.

So the answer to your question is no there is not an api function that does what you ask.

Upvotes: 0

Joe
Joe

Reputation: 42627

You will have to split the string in your function to determine the correct hive to make the call against.

Upvotes: 1

Danra
Danra

Reputation: 9906

Try RegQueryValue(Ex) and RegSetValue(Ex). You can look them up on msdn.

Upvotes: 0

Related Questions