码迷,mamicode.com
首页 > Windows程序 > 详细

C#循环注册表下的子键

时间:2015-04-15 19:11:14      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

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("无法获取系统版本");
}

C#循环注册表下的子键

标签:

原文地址:http://www.cnblogs.com/yuechen8080/p/4429351.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!