Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check Solidworks is installed?

Tags:

c#

solidworks

I have a c# application that runs on both 32-bit and 64-bit OS.In my app, how can I programatically check that solidworks is installed or not on computer.If we can check it by reading registry key ,then provide me path for both 32-bit and 64-bit.Tell me if there are other ways also to check it.

like image 552
user369182 Avatar asked May 24 '10 08:05

user369182


1 Answers

You could use WMI as follows

private static bool IsInstalled(string ProductName)
{

    bool rv = false;
    ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Product");
    ManagementObjectCollection Products = searcher.Get();
    if (Products.Count != 0)
    {
        foreach (ManagementObject product in Products)
        {
            if (product.Properties["Name"].Value.ToString() == ProductName)
            {
                rv = true;
            }
        }
    }
    return rv;           
}
like image 55
Charles Gargent Avatar answered Oct 28 '22 11:10

Charles Gargent