检查MS Access 2010中安装 [英] Check if MS Access 2010 is installed

查看:158
本文介绍了检查MS Access 2010中安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我保持目前检查,看看MS Access 2007中是否已安装的应用程序。它通过验证某个注册表项来实现的。

I am maintaining an application which currently checks to see whether MS Access 2007 is installed. It does this by verifying that a registry key exists.

public bool IsAccess2007Installed()
{
    RegistryKey rootKey = Registry.ClassesRoot.OpenSubKey(@"Access.Application.12\shell\open\command", false);

    return rootKey != null;
}

我怎么会去核实是否已安装MS Access 2010中?或者更好的是,我将如何验证的MS Access 2007或更高版本?

How would I go about verifying whether MS Access 2010 is installed? Or better yet, how would I verify that MS Access 2007 or later is installed?

有假设用户具有管理员权限。

It is assumed that the user has administrator privileges.

推荐答案

您可以检查该键的值(如Access.Application.12)代替。 HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes下\ Access.Application \ CURVER

You can check this key for a value (eg. Access.Application.12) instead. HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Access.Application\CurVer

所以,你的code线将是:

So your line of code would be:

RegistryKey rootKey = Registry.ClassesRoot.OpenSubKey(@"Access.Application\CurVer", false);

if (rootKey == null) return false;

string value = rootKey.GetValue("").ToString();
int verNum = int.Parse(value.subString(value.indexOf("Access.Application.")));
if (value.StartsWith("Access.Application.") && verNum >= 12)
{ return true; }

这篇关于检查MS Access 2010中安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆