Windows Registry

  • Thread starter Thread starter Eric D. Anderson
  • Start date Start date
E

Eric D. Anderson

I'm writing a program in C and I am wondering if there is a way to write to the registry?

For example, just to throw a line out there(cause its the only path I can think of off the top of my head)...if I wanted to write to "HKEY_CLASSES_ROOT\exefile\shell\open\command" how would I go about implementing it in my code ?
 
I'm writing a program in C and I am wondering if there is a way to write to the registry?

For example, just to throw a line out there(cause its the only path I can think of off the top of my head)...if I wanted to write to "HKEY_CLASSES_ROOT\exefile\shell\open\command" how would I go about implementing it in my code ?

--
Eric D. Anderson
Information Technology

In C++ - C++/CLI there are all kinds of easy-to-use class libraries, but I couldn't find any quickly for C.

If you are using plain C, then you have to use the win32 registry functions.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry_functions.asp

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
Eric D. Anderson said:
I'm writing a program in C and I am wondering if there is a way
to write to the registry?

I see that Bruno has already pointed you to the Registry API. That's the
"right" way to do it.

If your needs are minimal, you may be able to avoid the tedious
open/update/close trio of operations with wrappers provided by the shell :

http://msdn.microsoft.com/library/d...form/shell/reference/shlwapi/registry/reg.asp

for example SHSetValue(). Of course, the wrappers have no choice but to do
the open/update/close operations so if you find yourself manipulating the
same key often, it would be wiser to do it the right way.

Regards,
Will
 
Back
Top