Skip to content

Please help me in Registry

kkattamanchi

Asked Mar 10, 2005, 6:14 AM EST1 answer
Share
LinkedInX
hi, I want to prevent the user to open the CD ,so i write the following code: private void WriteValue(int Val ) { RegistryKey key =Registry.CurrentUser; try { RegistryKey valKey = key.OpenSubKey (@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", true); if(valKey == null) { key.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"); } valKey.SetValue("NoCDBurning", Val); } catch(Exception er) { MessageBox.Show(er.Message, "My Appli", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { _key.Close(); } } but also i can open the cd ,i don not know what is the error in my code??? Thanks

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi, Maybe you can look into Windows Management Instrumentation. It is quite handy to achieve what you want. Cheers.
    0