| Previous | Next | |
This sample demonstrates how to support the Windows "Add or Remove Programs" Control Panel and how to uninstall your application.
To add support for the "Add or Remove Program" Control Panel add a key for your product to the Windows Uninstall Registry -- i.e. "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"+yourProductName.
The "Add or Remove Program" Control Panel requires the key to include DisplayName and UninstallString values. Windows XP supports the additional values of Publisher, Display Version, HelpLink, and URLInfoAbout.
DisplayName is string shown for your application in the "Add or Remove Program" list. The UninstallString is the DOS command run when the user clicks the "Change/Remove" button in the program's list item. This sample application will uninstall itself when launched with a "/u" argument so the UninstallString consists of the full path to the application plus the "/u" flag. When the application runs it checks to see if it was launched with a "/u" command line argument using the mApplication.getArguments().
The additonal option items Publisher, Display Version, HelpLink, and URLInfoAbout are shown on XP when the user hits the "click here for support information" link.
Two other key methods used in this sample are mApplication.getMyPath() and mApplication.deleteSelf().
The method mApplication.getMyPath() returns the full path include the filename of the exe itself. This command is used to construct UninstallString value.
The mApplication.deleteSelf() designates the application for removal on reboot to complete the uninstall process. This command will also delete the applications containing folder if no other files (besides the exe) are found.
You can download this sample, "Uninstaller", from the mProjector Samples page -- http://www.screentime.com/software/mprojector/flas.html#uninstaller.
| Questions or Feedback? | Previous | Next |