C#循环注册表下的子键_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > C#循环注册表下的子键

C#循环注册表下的子键

 2015/4/15 18:47:28  大约,在冬季  程序员俱乐部  我要评论(0)
  • 摘要:publicstaticboolIsAisino(){boolIsAisino=false;//获取注册表路径RegeditKeyregeditKey=TaxSoftwareBaseInfo.GetRealyTrueRegeditPath(WindowsInfo.GetWindowsVersion());RegistryKeyregSubKey=null;//获取驱动路径regSubKey=regeditKey.Registry.OpenSubKey
  • 标签:C# 注册表 循环

public static bool IsAisino()
{
bool IsAisino = false;
//获取注册表路径
RegeditKey regeditKey = TaxSoftwareBaseInfo.GetRealyTrueRegeditPath(WindowsInfo.GetWindowsVersion());
RegistryKey regSubKey = null;
//获取驱动路径
regSubKey = regeditKey.Registry.OpenSubKey(@"System\CurrentControlSet\Control\Print\Printers\", false);
string[] rk = regSubKey.GetSubKeyNames();
foreach (var item in rk)
{

}

}

 

 

/// <summary>
/// 获取当前计算机系统版本
/// </summary>
/// <returns></returns>
public static WindowsVersion GetWindowsVersion()
{
int version = Environment.OSVersion.Version.Major;
string os = String.Concat(Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("ProductName").ToString());//, " ", Environment.OSVersion.ServicePack
if (os.Contains("7"))
{
if(GetSystemType()==64)
return WindowsVersion.Windows7_64Bit;
else
return WindowsVersion.Windows7_32Bit;
}
if (os.Contains("8"))
{
if (GetSystemType() == 64)
return WindowsVersion.Windows8_64Bit;
else
return WindowsVersion.Windows8_32Bit;
}

if (os.Contains("XP") && os.Contains("xp"))
{
if (GetSystemType() == 64)
return WindowsVersion.WindowsXP;
else
return WindowsVersion.WindowsXP;
}

int banben = GetSystemType();
throw new Exception("无法获取系统版本");
}

发表评论
用户名: 匿名