joe_pool_is
Contributor
I have tried writing values to the Registry below. Even though the Registry Key "rk" is non-NULL, inspecting the Registry afterwards in the HKCU Software section does not show any new settings.
Can the Registry be modified in Visual C++ 2005 Express (i.e. CLR)?
I tried this code (actually C++ code, not CS):
Can the Registry be modified in Visual C++ 2005 Express (i.e. CLR)?
I tried this code (actually C++ code, not CS):
C#:
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;
}
}