static void createRegistryKey(string item, string content)

        {
            RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Test1111", true);
            if( rk==null )
            {
                rk = Registry.LocalMachine.OpenSubKey("SOFTWARE", true).CreateSubKey("Test1111");
            }


            rk.SetValue(item, content);


            rk.Close();
            rk = null;
        }
        static string readRegistryKey(string item)
         {
             RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Test1111", true);


             if (rk == null)
                 return "";


             string st = rk.GetValue(item).ToString();


             if (st ==null)
                 st = "";


             rk.Close();
             rk = null;
             return st;               
         }

arrow
arrow
    全站熱搜

    createps 發表在 痞客邦 留言(0) 人氣()