joe_pool_is Posted July 5, 2006 Posted July 5, 2006 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):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; } } Quote Avoid Sears Home Improvement
Leaders snarfblam Posted July 5, 2006 Leaders Posted July 5, 2006 I see no reason why this should not work. I'm not trying to call you stupid, but you have refreshed regedit after you ran the code, right? No exceptions being thrown? You have the necessary permissions? And your positive that the form is being disposed (destructed)? Have you tried verifying the results in code (re-read the registry key, show result in messagebox or w/e)? Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.