This article will detail in 10 easy steps
how to create your own Uninstall icon (and place it in the Program Group) for
every VB project that you create. The problem with P&D Wizard is that it
will not allow you to create an icon in the icon group that points to
St6unst.exe (the uninstaller for VB). I have created program for my family, they
have installed them, and then in their infinite wisdom, simply gone into My
Computer and deleted the folder(s) for the program not realizing that they must
go to Add/Remove Programs to uninstall it from there. This deletes the
St6unst.log file and thus renders the uninstall process null and void! So we are
going to provide "computer illiterate" people (like my family) with
another icon, in the start menu of your program, to uninstall your program!
Before we get started, just a quick note to
help you read the article better. Any text in Italics
will denote text that is optional or can be renamed as you choose. Ok,
let's get started!
- Create a new Standard Project in VB, add one
Form and one Module (bas) to the project.
- Rename the Project Uninstall, and the
- Add an icon to Form1 (the form does
not really need to be renamed as the form will only be used for its
icon), I use the icon located at Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Win95\RECYFULL.ICO.
- In the unInstall module add a
"Sub Main". Go to Project Properties and set "Sub Main"
as the startup object. While in the Project Properties, click on the Make
Tab and click on the Icon dropdown to select Form1. This sets your
executables Icon to the icon you chose for Form1.
- In Sub Main add the following lines of code
(this is the only code needed for your uninstaller program) which will open
the Add/Remove Programs Dialog of the Control Panel:
'opens the Add/Remove Programs
dialog of the Control Panel
Shell "rundll32.exe shell32.dll,Control_RunDLL
- Save the project to it's own folder (location
of your choice) and compile the project to the same folder.
- Now, whenever you package a project, include
this Unistall.exe file with your other project files. During the
Package process, when you get to the Included Files, click the Add button
and navigate to the folder where you compiled the Unistall.exe
program and include that file with your current project.
- A few steps later in the Start Menu Items
step, click New Item. Name the New Item Uninstall APPNAME (where
APPNAME is the name of the application that you are currently packaging).
- Set the Target for this New Item to the Uninstall.exe
- In the next step, Install Locations, be sure
that the install location for your Uninstall.exe file is the
You've done it! A very simple, easy way
to safe guard your users from, well, themselves! Now every time they go to the
start menu to run your program, they will see the "Uninstall"
icon there as well. When they click on this Uninstall APPNAME icon, it
will open the Add/Remove Programs Dialog of the Control Panel and prompt them to
uninstall the program from there!
I hope that you find this article useful. If
you do please be sure to come back and vote! I would appreciate your
votes AND comments too. Hope you have a great day!