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 ...
随机推荐
- HTML文档类型声明的坑...
如果发现js莫名其妙的报错(比如demo不报错,自己写的就报错),或者样式显示不正常,一定记得检查HTML页面里面加没加如下文档声明: <!DOCTYPE HTML PUBLIC "- ...
- 浙江工商大学15年校赛E题 无邪的飞行棋 【经典背包】
无邪的飞行棋 Time Limit 1s Memory Limit 64KB Judge Program Standard Ratio(Solve/Submit) 15.38%(4/26) Descr ...
- ring0和ring3的区别
现在探讨内核程序和应用程序之间的本质区别.除了能用WDK编写内核程序和阅读一部分Windows的内核代码之外,我们还需要了解它们的本质是什么,它们和我们熟悉的应用程序有什么区别. Intel的x86处 ...
- Fiddler 教程(转)
阅读目录 Fiddler的基本介绍 Fiddler的工作原理 同类的其它工具 Fiddler如何捕获Firefox的会话 Fiddler如何捕获HTTPS会话 Fiddler的基本界面 Fiddler ...
- [转]如何申请和管理一个sourceforge项目
假如你没有贡献免费源代码的想法,就不用继续读本文了.:) 如果读者的e文不错,作者建议你直接阅读sourceforge的 howto文档,他们整理得非常周到详实.本文只是作者的使用经验,也许可以给与作 ...
- PLSQL Developer过期要注冊表
打开执行输入 regedit 打表注冊表 删除 HKEY_CURRENT_USER\Software\Allround Automations HKEY_CURRENT_USER\Software\M ...
- svn: keywords
在文件头里面加入下面的关键字: $Date$ $ID$ $Revision$ $Author$ 代码在svn提交时,先选中这几个关键字再提交. Date可能出现中文乱码: 在Control Panel ...
- ZOJ3768 夹逼查找【STL__lower_bound()_的应用】
首先学习一下lower_bound() 函数lower_bound()在first和last中的前闭后开区间进行二分查找,返回大于或等于val的第一个元素位置.如果所有元素都小于val,则返回last ...
- 大数据时代的 9 大Key-Value存储数据库
在过去的十年中,计算世界已经改变.现在不仅在大公司,甚至一些小公司也积累了TB量级的数据.各种规模的组织开始有了处理大数据的需求,而目前关系型数据库在可缩放方面几乎已经达到极限. 一个解决方案是使用键 ...
- 盘点:#AzureChat - 虚拟机和自动伸缩
感谢大家跟 Corey Sanders 和 Stephen Siciliano 一起参加本次 #AzureChat.我们很高兴能借这次在线讨论的机会,倾听各位社区成员对我们最受欢迎的两个主题的意见 - ...