Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.");

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

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...

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top