小标
2018-05-18
来源 :
阅读 2486
评论 0
摘要:本次的c#入门经典向大家介绍了注册表操作全解,让大家学习注册表操作全解有所帮助,希望大家在c#入门经典的路上走的更远。
本次的c#入门经典向大家介绍了注册表操作全解,让大家学习注册表操作全解有所帮助,希望大家在c#入门经典的路上走的更远。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Management;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
namespace util
{
public class 注册表数据
{
public static void setRegistry(String[] args) //setRegistry("SOFTWARE","Microsoft","Internet Explorer","Main","FeatureControl",);
{
RegistryKey zhuce1 = Registry.LocalMachine;
for (int i = 0; i < args.Length - 2;i++ )
{
zhuce1 = zhuce1.OpenSubKey(args[i], true);
}
zhuce1.SetValue(args[args.Length - 2], args[args.Length - 1]);
}
public static List<string> 软件列表信息(int 选择)
{
List<string> 返回列表 = new List<string>();
RegistryKey liebiao = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", true);
if (liebiao != null)
{
foreach (String ruanjian in liebiao.GetSubKeyNames())
{
RegistryKey ruanjian2 = liebiao.OpenSubKey(ruanjian, false);
if (ruanjian2 != null)
{
string softwarename = ruanjian2.GetValue("DisplayName", "").ToString();
string quanlujing = ruanjian2.GetValue("DisplayIcon", "").ToString();
if (!string.IsNullOrEmpty(quanlujing))
{
if (选择 == 1)
返回列表.Add(softwarename);
if (选择 == 2)
返回列表.Add(quanlujing);
}
}
}
}
return 返回列表;
}
public static int cpu频率()
{
RegistryKey cpu频率1 = Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0");
object cpu频率2 = cpu频率1.GetValue("~MHz");
return (int)cpu频率2;
}
public static string cpu名称()
{
RegistryKey cpu名称1 = Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0");
object cpu名称2 = cpu名称1.GetValue("ProcessorNameString");
return (string)cpu名称2;
}
}
}
</string></string></string>本文由职坐标整理并发布,了解更多内容,请关注职坐标编程语言C#.NET频道!
喜欢 | 0
不喜欢 | 0
您输入的评论内容中包含违禁敏感词
我知道了

请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式AI+学习就业服务平台 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号