We have a program that creates text files. If the user wants to view the contents, we have an option to view them in NotePad.
We have recieved a request to allow the user to view them in TextPad. While we have a site license for TextPad, installation is optional and not everyone has TextPad installed.
We would like our program to detect that the user has installed TextPad. What is the best method that works across all versions? The site installer is version 4.5, but once you have installed that you can upgrade to the latest version, so we need to support every TextPad version from 4.5 on.
Thanks,
Edward Ellis
Is TextPad installed?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Here is my best guess in VB.NET 2005. Does someone have a better test? This would be hard to do in a simpler environment such as an installer.
Code: Select all
Private Function IsTextPadInstalled() As Boolean
Dim value As Microsoft.Win32.RegistryKey = My.Computer.Registry.LocalMachine
If value Is Nothing Then Return False
value = value.OpenSubKey("Software", False)
If value Is Nothing Then Return False
value = value.OpenSubKey("Helios", False)
If value Is Nothing Then Return False
value = value.OpenSubKey("TextPad", False)
If value Is Nothing Then Return False
Return True
End Function
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Perhaps you should ask the developers directly:
http://www.textpad.com/support/textpad.php or support@textpad.com.
http://www.textpad.com/support/textpad.php or support@textpad.com.
I have,
"HKEY_CURRENT_USER\Software\Helios\TextPad 4" but no Helios stuff under HKEY_LOCAL_MACHINE.
My guess is that values under HKLM means that TextPad is installed for all users but values under HKCU means TextPad is installed for the current user but not all users!
The RegistryKey class has a GetSubKeyNames method that returns a string array of subkey names.
You could invoke this on the "Helios" key an check if one of them starts with "TextPad".
See: http://msdn2.microsoft.com/en-us/micros ... names.aspx
"HKEY_CURRENT_USER\Software\Helios\TextPad 4" but no Helios stuff under HKEY_LOCAL_MACHINE.
My guess is that values under HKLM means that TextPad is installed for all users but values under HKCU means TextPad is installed for the current user but not all users!
The RegistryKey class has a GetSubKeyNames method that returns a string array of subkey names.
You could invoke this on the "Helios" key an check if one of them starts with "TextPad".
See: http://msdn2.microsoft.com/en-us/micros ... names.aspx