Visual Basic Concepts

Allowing the User to Remove Your Application

See Also

When the user installs your application, the setup program copies the application-removal utility St6unst.exe to the \Windows or \Winnt directory. Each time you use the Visual Basic setup program to install an application, an application removal log file (St6unst.log) is generated in the application's installation directory. The .log file contains entries indicating:

In Windows 95, Windows NT 4.0, or later systems, the setup program adds the application removal utility to the list of registered applications displayed in the Add/Remove Programs section of Control Panel. End users should use Add/Remove Programs to uninstall the application.

Caution   It is important to make sure that you have correctly set options for any files that should be shared, either by adding the files to the Shared Files screen in the Package and Deployment Wizard, or by indicating the installation location for the file as a shared file directory. If you accidentally install a file that should be shared without the correct settings, users will be able to remove it when they uninstall your application, which may cause problems for other applications on your system.

In the event of a failed or canceled installation, the application-removal utility automatically removes all of the directories, files, and registration entries that the setup program created in the installation attempt.

With Windows 95 or later and Windows NT, shared files are reference-counted in the registry. For example, a shared file used by three applications will have a reference count of three. When you remove an application that uses a shared file, the reference count for the shared file decreases by one. When the count for the file reaches zero, the user will be prompted for final removal of that item.

Situations in Which the Application Removal Utility Might Fail

For the application-removal utility to properly uninstall your application, the log file and registry entries created by the setup program must be accurate and unchanged from the time of installation.

The Application Removal utility might fail or work incorrectly if any of the following situations exists:

Some of these scenarios could degrade the installed file-registry correspondence, cause the Application Removal utility to prematurely reach a zero-reference count for a particular file, and subsequently ask if this file could be deleted. If a file is prematurely deleted, it could cause other applications to cease functioning or function incorrectly due to missing file dependencies, missing components, and so on.