国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

C#:如何獲取當前操作系統的軟件版本

2024-07-21 02:28:35
字體:
來源:轉載
供稿:網友

我是一個c#的初學者,這是我參考一些資料,自己弄的一個通過訪問當前操作系統的注冊表來獲取當前操作系統相關信息的小程序,僅供參考。

 1using system;
 2using system.collections.generic;
 3using system.componentmodel;
 4using system.data;
 5using system.drawing;
 6using system.text;
 7using system.windows.forms;
 8using microsoft.win32;
 9
10namespace reg4u
11{
12    public partial class form1 : form
13    {
14        public form1()
15        {
16            initializecomponent();
17        }
18
19        private void button1_click(object sender, eventargs e)
20        {
21            registrykey rk;
22            rk = registry.localmachine.opensubkey("software//microsoft//windows nt//currentversion");
23            string s= "當前操作系統版本:"+rk.getvalue("productname").tostring();
24            s = s +"/r/n"+rk.getvalue("csdversion").tostring() ;
25            s = s + "/r/n當前操作系統安裝序列號:/r/n" + rk.getvalue("productid").tostring();
26            s = s + "/r/n當前系統版本號:" + rk.getvalue("currentbuildnumber").tostring();
27            rk.close();
28            textbox1.text = textbox1.text+"/r/n"+s;
29        }
30
31        private void form1_load(object sender, eventargs e)
32        {
33            registrykey rk;
34            rk = registry.localmachine.opensubkey("software//microsoft//windows nt//currentversion");
35            string s = rk.getvalue("productname").tostring();
36            if (system.text.regularexpressions.regex.ismatch(s, "windows 2000"))
37            {
38                textbox1.text = "您的操作系統是2k,恭喜您,你的當前系統適合本軟件的使用!";
39            }
40            rk.close();
41        }
42    }
43}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 延川县| 东城区| 镇赉县| 成安县| 宁河县| 卫辉市| 饶河县| 泸水县| 唐海县| 云和县| 内黄县| 萨迦县| 贵南县| 台中县| 陵水| 寿光市| 广安市| 夏津县| 尤溪县| 万安县| 上饶市| 栾城县| 博白县| 长宁区| 蒙自县| 宿迁市| 旬邑县| 报价| 安福县| 开化县| 杭州市| 太仓市| 大安市| 广西| 赤水市| 横山县| 三都| 东乌珠穆沁旗| 道真| 台东县| 长岭县|