Using Visual C++ 2005 Express (CLR):
I can't seem to find an example or documentation on how to read/write
information to the Registry.
Are Registry Settings now outdated? What else could I use to store things
like file locations, etc?
I'm coming from Borland C++ Builder, and I'm trying to learn how to work
with VC Express. Code, links, examples, and techniques are all appreciated.
poojo hackma - 29 Jun 2006 16:47 GMT
I found a Registry example that I am working through.
Still, if there is a more accepted method of storing items like "recent
files" other than using the Registry or an INI file (very old), please let
me know.
poojo hackma - 29 Jun 2006 21:23 GMT
Ok, I still need help here.
I tried this code:
//--------------------------------------
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
String^ strKey;
strKey = "Software\\Slick Co\\FancySoft 2";
RegistryKey^ rk = nullptr;
rk = Registry::CurrentUser->OpenSubKey(strKey);
if (rk) {
rk->Close();
}
}
protected:
~Form1()
{
String^ strKey;
strKey = "Software\\Slick Co\\FancySoft 2";
RegistryKey^ rk = nullptr;
rk = Registry::CurrentUser->OpenSubKey(strKey, true);
if (!rk)
{
rk->CreateSubKey(strKey);
}
if (rk)
{
rk->Close();
}
if (components)
{
delete components;
}
}
//------------------------------------
Even though sometimes the Registry Key is non-NULL, inspecting the Registry
afterwards in the HKCU Software section does not show any new settings.
Could someone throw me a bone here? People still use the Registry, don't
they? This can be done in Visual C++ 2005 Express (i.e. CLR), can't it?