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 ?

Signature
Eric D. Anderson
Information Technology
Bruno van Dooren - 08 Apr 2006 07:49 GMT
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/re
gistry_functions.asp

Signature
Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"
William DePalo [MVP VC++] - 08 Apr 2006 16:34 GMT
> 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/default.asp?url=/library/en-us/shellcc/platfor
m/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
Eric D. Anderson - 08 Apr 2006 18:01 GMT
Thanks for the replies!
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