asp.net中通过注册表来检测是否安装Office(迅雷/QQ是否已安装)
原文 asp.net中通过注册表来检测是否安装Office(迅雷/QQ是否已安装)
检测Office是否安装以及获取安装 路径 及安装版本
| 代码如下 | 复制代码 |
|
#region 检测Office是否安装 |
|
同理,检测QQ、Fetion、360杀毒、IE浏览器,Chrome、Office 2003/2007/2010
只需修改验证
1 regSubKey = regKey.OpenSubKey(@"SOFTWARETencentPlatForm_Type_List3", false);//如果bool值为true则对打开的项进行读写操作,否则为只读打开
即可
检测QQ是否已安装,通过注册表
| 代码如下 | 复制代码 |
|
#region 检测QQ是否安装 |
|
检测迅雷
| 代码如下 | 复制代码 |
| #region 检测 Thunder 迅雷 public static bool isInstallThunder(out string thunderVersion, out string thunderPath) { bool result = false; string str_ThunderPath = string.Empty; string str_ThunderVersion = string.Empty; thunderVersion = string.Empty; thunderPath = string.Empty; GetThunderPath(out str_ThunderPath, out str_ThunderVersion); if (!string.IsNullOrEmpty(str_ThunderPath) && !string.IsNullOrEmpty(str_ThunderVersion)) { result = true; thunderVersion = str_ThunderVersion; thunderPath = str_ThunderPath; } return result; } /// <summary> /// /// </summary> /// <param name="str_QQPath"></param> /// <param name="str_QQVersion"></param> private static void GetThunderPath(out string str_thunderPath, out string str_thunderVersion) { string str_PatheResult = string.Empty; string str_VersionResult = string.Empty; string str_KeyName = "Path"; object objResult = null; Microsoft.Win32.RegistryValueKind regValueKind;//指定在注册表中存储值时所用的数据类型,或标识注册表中某个值的数据类型。 Microsoft.Win32.RegistryKey regKey = null;//表示 Windows 注册表中的项级节点(注册表对象?) Microsoft.Win32.RegistryKey regSubKey = null; try { regKey = Microsoft.Win32.Registry.LocalMachine;//读取HKEY_LOCAL_MACHINE项 if (regSubKey == null) regSubKey = regKey.OpenSubKey(@"SOFTWAREThunder NetworkThunderOemthunder_backwnd", false);//如果bool值为true则对打开的项进行读写操作,否则为只读打开 str_VersionResult = "Thunder"; str_KeyName = "Path"; } objResult = regSubKey.GetValue(str_KeyName); regValueKind = regSubKey.GetValueKind(str_KeyName); if (regValueKind == Microsoft.Win32.RegistryValueKind.ExpandString) { str_PatheResult = objResult.ToString(); } } catch (Exception ex) { LogHelper.WriteLogError(ex.ToString()); } finally { if (regKey != null) { regKey.Close(); regKey = null; } if (regSubKey != null) { regSubKey.Close(); regSubKey = null; } } str_thunderPath = str_PatheResult; str_thunderVersion = str_VersionResult; } #endregion |
|
asp.net中通过注册表来检测是否安装Office(迅雷/QQ是否已安装)的更多相关文章
- 使用.NET 4.0+ 操作64位系统中的注册表
一.64位系统中的注册表 以 LocalMachine 中的启动项为例: 64位应用的注册表位置还是在: SOFTWARE\Microsoft\Windows\CurrentVersion\Run 而 ...
- C# asp.net中导出Excel表时总出现"只能在执行 Render() 的过程中调用 RegisterForEventValidation
C# asp.net中导出Excel表时总出现"只能在执行 Render() 的过程中调用 RegisterForEventValidation 后台添加以下方法:/// <summa ...
- Unity中对注册表进行修改
问题背景: PC端软件开发,当我在Unity中的PlayerSetting中设置好分辨率,每次打包运行后会记忆上次退出时窗口的分辨率(记忆窗口状态),导致下次打开时不是PlayerSetting中的初 ...
- 用 C# 在 Windows 7 中写注册表想到的
摘自:http://blog.163.com/dpj_001/blog/static/2742941520110251500753/ 某日做一个项目,需要在注册表中加入键,同时写值,操作系统环境为 W ...
- Ruby Rails学习中:注册表单,注册失败,注册成功
接上篇 一. 注册表单 用户资料页面已经可以访问了, 但内容还不完整.下面我们要为网站创建一个注册表单. 1.使用 form_for 注册页面的核心是一个表单, 用于提交注册相关的信息(名字.电子邮件 ...
- 在Unity中对注册表的信息进行操作
问题1 在对注册表进行操作时无法生成注册表相关的类 解决办法: 增加头文件using Microsft.Win32; 问题2 在运行程序时报错同时注 ...
- 使用MSBUILD 构建时出错 error MSB3086: 任务未能使用 SdkToolsPath“”或注册表项“XXX”找到“LC.exe”,请确保已设置 SdkToolsPath。
如果项目有添加有WB引用,比如引用其它网站的WEB服务等,那么VS在编译时会自动生成个 [项目名称].Serializers.dll的文件,就是把引用服务中的相关对象信息生成硬编码的程序集,以提高效率 ...
- ASP.NET中后台注册js脚本攻略(转)
用Page.ClientScript.RegisterClientScriptBlock 和Page.ClientScript.RegisterStartupScript:区别: 1.使用Page ...
- asp.net中通过form表单submit提交到后台的实例
前台<body>中的代码: <body> <div id="top"> </div> <form id="login ...
随机推荐
- excel unixtime与北京时间互转
unixtime转北京时间,在单元格内输入:=INT((B2-70*365-19)*86400-8*3600) *.要设置一下单元格格式为y-m-d h:m:s才会正确显示 北京时间转unixti ...
- Codeforces 484A - Bits 二进制找1
这题可以根据l, r 在二进制下的长度进行分类. l 的长度小于 r 的时候,有两种可能,一种是r 在二进制下是 1* 这种样子,故答案取 r : 一种是取答案为 (1LL << (r ...
- (Problem 17)Number letter counts
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + ...
- 转:js包装DOM对象
我们在日常的应用中,使用Javascript大多数时间都是在用DOM ,以致于很多人都有一种看法就是DOM==JS,虽然这种看法是错误的,但是也可以说明DOM的重要性. 这就导致了我们在写JS的时候, ...
- 第2次增加ssh 主机信任脚本
dr-mysql01:/root# cat a1.sh #用户名 uname="$1" #密码 passwd="$2" #执行检测并安装expect模块 ep= ...
- CMake入门指南
原文地址:http://www.cnblogs.com/sinojelly/archive/2010/05/22/1741337.html CMake是一个比make更高级的编译配置工具,它可以根据不 ...
- 提高mysql查询效率的六种方法
1,表设计一定要优化,冗余数据最少,少用连接查询.如果在实际应用中,使用了极其复杂的连接,子查询,则数据表的设计得要重新考虑了. 2,尽量用char而不是varchar,因为固定长度得string用起 ...
- javascript 动态推断html元素
在javascript中为了针对不同的元素运行不同的操作,须要在javascript中对触发事件的元素进行推断,然后运行不同的操作. 样例: html <input type='button' ...
- Vi/VIM键盘图, Vi/vim学习图
Vi/vim学习图 引用: Vi键盘图片可视化教程 http://www.cnblogs.com/me115/archive/2010/11/16/1878295.html 网上的文章易流失.感谢分享 ...
- jfinal集成spring cxf做webservice服务
链接地址:http://zhengshuo.iteye.com/blog/2154047 废话不说,直接上代码 新增cxf的plugin CXFPlugin package com.jfinal.pl ...