Is TextPad installed?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
d3j409
Posts: 5
Joined: Tue May 09, 2006 4:43 pm

Is TextPad installed?

Post by d3j409 »

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
ben_josephs
Posts: 2459
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Look in the registry? "HKCU\Software\Helios\TextPad 4"?
d3j409
Posts: 5
Joined: Tue May 09, 2006 4:43 pm

Post by d3j409 »

That works fine for 4.5 through 4.x, but what about TextPad 5, 6, or 7? The software I write is special purpose and is not enhanced often, so it needs to be durable far into the future. I also looked in HKLM\Software\Helios\TextPad, but I did not find any version independant keys that have values.
d3j409
Posts: 5
Joined: Tue May 09, 2006 4:43 pm

Post by d3j409 »

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
ben_josephs
Posts: 2459
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

I don't have an "HKLM\Software\Helios\TextPad"; I have an "HKLM\Software\Helios\TextPad 4". And its presence seems to indicate that there is a TextPad licence on the machine, not that TextPad is installed for any user.
d3j409
Posts: 5
Joined: Tue May 09, 2006 4:43 pm

Post by d3j409 »

Well, so much for that idea! Maybe there is no version independant way of detecting that TextPad is installed. :cry:
ben_josephs
Posts: 2459
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Perhaps you should ask the developers directly:
http://www.textpad.com/support/textpad.php or support@textpad.com.
Lostclown
Posts: 8
Joined: Fri Oct 15, 2004 1:12 pm
Location: Iceland

Post by Lostclown »

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
Post Reply