确定是否安装了 Google 地球(在 Windows 上)

发布于 2024-08-05 06:36:54 字数 204 浏览 6 评论 0原文

我有一个 VB.NET 应用程序,可以生成 KML 以在 Google 地球中显示。我只是对创建的 .KML 文件执行 Process.Start 。问题显然是“如果没有安装谷歌地球怎么办”,这就是我想避免的。

在 Windows 中(不是网络)有没有办法确定是否安装了 Google 地球?如果没有,我会提示他们这是必需的,如果是的话,我将继续该过程。

谢谢。

I have a VB.NET app that generates KML to show within Google Earth. I simply do a Process.Start on the .KML file created. The problem is obviously "what if Google Earth isn't installed" and that's what I want to avoid.

Is there a way, in Windows, (not web) to determine if Google Earth is installed? If not, I'll prompt them that it's required, if so, I'll proceed with the process.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

装迷糊 2024-08-12 06:36:54

检查注册表中的 HKEY_CURRENT_USER\Software\Google\Google Earth Plus\
...我自己从未这样做过,但这似乎合乎逻辑。

Check the registry for HKEY_CURRENT_USER\Software\Google\Google Earth Plus\
...never done this myself but it seems logical.

甜扑 2024-08-12 06:36:54

查看 Google 地球是否是 .kml 文件的处理程序:

C#

RegistryKey key = RegistryKey.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\.kml");
if(key != null)
{
    string kmlHandler = key.GetValue("", "None");
    if(kmlHandler == "None")
    {
        MessageBox.Show("Google Earth not installed.");
    }
}
else
    MessageBox.Show("Google Earth not installed.");

See if Google Earth is the handler for .kml files:

C#

RegistryKey key = RegistryKey.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\.kml");
if(key != null)
{
    string kmlHandler = key.GetValue("", "None");
    if(kmlHandler == "None")
    {
        MessageBox.Show("Google Earth not installed.");
    }
}
else
    MessageBox.Show("Google Earth not installed.");
世界和平 2024-08-12 06:36:54

检查 %program files%/Google Earth 文件夹是否存在。

Check if %program files%/Google Earth folder exists.

秋风の叶未落 2024-08-12 06:36:54

查看是否可以找到 Google 地球在安装时创建的一些注册表项(并在卸载时删除)。如果它们存在,该程序很可能也存在。与文件或文件夹相比,用户篡改注册表的可能性要小得多......

See if you can find some registry entries that Google Earth creates upon installation (and removes when un-installed). If they exist, the program most likely does too. And the users are much less likely to tamper with the registry than with files or folders...

属性 2024-08-12 06:36:54

安装程序时,要求用户导航到 Google Earth .exe 所在的文件夹。

如果他们在您的应用程序之后安装 Google 地球并尝试启动 KML 文件,则在您启动 KML 之前提示用户导航到其 Google 地球文件夹。不过,不要要求他们安装 Google 地球,因为他们可能有另一个与他们想要使用的 KML 关联的应用程序。

On install of your program, ask the user to navigate to the folder where the Google Earth .exe is located.

If they install Google Earth after your app and try to launch a KML file, then prompt the user to navigate to their Google Earth folder before you launch the KML. Don't require them to have Google Earth installed, though, as they may have another app associated with KMLs that they want to use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文