in reply to Getting Windows control panel to invoke an uninstall script

It's really just a matter of creating registry key under HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall. The name can be anything; it's not displayed.

In that key, create the following strings:

For example, the one for IE6 is:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstal +l\IE40] "DisplayName"="Microsoft Internet Explorer 6 SP1" "DisplayIcon"="C:\\Program Files\\Internet Explorer\\iexplore.exe" "UninstallString"="rundll32 C:\\WINNT\\system32\\setupwbv.dll,IE6Maint +enance C:\\Program Files\\Internet Explorer\\IE Uninstall\\W2KEXCP.EX +E /u"

Someone should be able to recommend you an installer that does this for you.

Replies are listed 'Best First'.
Re^2: Getting Windows control panel to invoke an uninstall script
by Anonymous Monk on Dec 18, 2004 at 18:14 UTC
    Good tip. Thanks. I was able to use Win32::TieRegistry to
    implement it. I ran a couple of "proof of concept" tests. It works okay
    To save others some leg work, here is the code I will be implementing in my installer (Windows ME version):

    use Win32::TieRegistry;
    my $uninstall_path =
    "LMachine\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
    my $uninstall_bat =
    "c:\\Windows\\Profiles\\$loginname\\My\ Documents\\uninstall.bat";

    $key = new Win32::TieRegistry "$uninstall_path";
    $prog_key = $key->CreateKey( "$my_program_name");

    $prog_key->SetValue( "DisplayName", "$my_program_name" );
    $prog_key->SetValue( "UninstallString", "$uninstall_bat" );


    ##########################
    Here is the I will be implementing in my uninstaller (Windows ME version). That is, somewhere in the
    uninstall.bat defined for UninstallString, after all the other uninstall work has been done

    use Win32::TieRegistry;

    my $uninstall_key_path =
    "LMachine\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
    my $key = new Win32::TieRegistry "$uninstall_key_path";
    delete $key->{"\\$my_program_name"};
    undef $key;

      I'd write that more like:

      my $Reg; use Win32::TieRegistry( TiedRef => $Reg, Delimiter => '/' ); $Reg->{ "LMachine/Software/Microsoft/Windows/" . "CurrentVersion/Uninstall/$name/"} = { DisplayName => $name, UninstallString => $uninstallPath, } or die "Can't load registry: $^E";

      But there are a lot of ways to use that module.

      - tye        

Re^2: Getting Windows control panel to invoke an uninstall script
by Anonymous Monk on Dec 18, 2004 at 18:33 UTC
    Arrrgh! The uninstall portion of my code had a bug (understatement). Sorry about that.
    The code below has been tested on Windows Millenium.

    use Win32::TieRegistry ( Delimiter=>"/", ArrayValues=>1 );
    my $program_name = "ezbackup";

    $Registry->Delimiter("/"); # $Registry is imported from TieRegistry
    my $uninstall_key =
    $Registry->{"LMachine/Software/Microsoft/Windows/CurrentVersion/Uninstall/"};

    delete $uninstall_key->{"$program_name/DisplayName"};
    delete $uninstall_key->{"$program_name/UninstallString"};
    delete $uninstall_key->{"$program_name/"};

    undef $uninstall_key;