private string GetCurrentComputerName()//测试成功
{

         string sLocal; //本机计算机名
//记住必须使用Registry.LocalMachine.OpenSubKey()成员函数来初始化变量
RegistryKey regLocal=Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName");
sLocal=regLocal.GetValue("ComputerName").ToString();
regLocal.Close();
sLocal=sLocal.Trim();//记住去掉可能的空格
return sLocal;}