Reputation: 14528
For a script that will check/set a Windows registry value. No GUI.
Am writing in Visual Studio, but do not want .NET - just C++.
However, I haven't figured out where and what methods exist natively in C++ [NOT Visual C++]
that interface with the registry.
I also haven't worked out how to compile C++ code in Visual Studio 2010 without .NET.
Can someone please direct me to the documentation (or even better, tutorials) of the standard C++ registry related methods.
And furnish me with instructions or point out a tutorial that will allow a complete and total noob to compile in VS a non .NET program.
Please do NOT argue about my aversion to .NET, that has been the subject of other threads.
Upvotes: 0
Views: 1136
Reputation: 14791
Generally the flow goes something like:
RegOpenKeyEx
. The last parameter is a pointer to a registry key handle for the opened key (if the open is successful).RegSetValueEx
, you can add new subkeys using RegCreateKeyEx
, and delete keys using RegDeleteKey
.RegCloseKey
.There is a tutorial to be found here.
Unfortunately I don't use VS, so I'm not the person to help you with compiling "vanilla" C++ in that. That said though, I imagine it shouldn't be all that difficult - there's probably an option somewhere for a "Plain C++" project.
Upvotes: 2
Reputation: 8644
You can also use Stlsoft's registry components for an STL-like interface.
Upvotes: 0
Reputation: 6983
You can use mfc. This shows how http://www.endurasoft.com/techtalk/regdemo1.htm
or atl http://msdn.microsoft.com/en-us/library/xka57xy4(v=vs.71).aspx
Upvotes: 0
Reputation: 7135
To create a native C++ console application in VS 2010: http://msdn.microsoft.com/en-us/library/46e82t5z.aspx
To check/set registry values using Win32 APIs: http://msdn.microsoft.com/en-us/library/ms724875%28v=VS.85%29.aspx
Upvotes: 1
Reputation: 400700
Here's a list of all of the native functions for interacting with the registry. The most useful ones are probably RegOpenKeyEx
, RegQueryValueEx
, RegSetValueEx
, and RegCloseKey
.
A number of good articles describing usage of the registry can be found here.
Upvotes: 2