How to write an automatic anti-installation program using VB?
If you have installed a certain software, you want to install it, you have two methods: 1. Open [Add Remove New Program] in [Control Panel], select the software to reverse installation. 2. Select [Start] [assembly] in the program group generated by the software generated. The first method above, you don't need any processing, general software is installed in [Control Panel] in [Control Panel] in [Control Panel]. In the second method, we must write a program to solve it! Suppose today we have written a program called Test. After you complete Test.exe, you must write an automatic anti-installation program, we set the file name to untest.exe (Don't worry about how to write, will later explain ).
After the two procedures are completed, you must add untest.exe when you use the Application Setup Wizard provided by the VB. After joining untest.exe, after the user is installed, the installer does not add this automatic anti-installer untest.exe in the [Test] generated in the [Test] of the system [Test] in the [Test] of the system. Only copy untest.exe together with Test.exe to copy to the application's directory! So if you want to generate untest.exe shortcuts, you may need to change a slightly modified application installation wizard for VB! The following we actually look at how untest.exe programs: Create a new document in VB, name untest.vbp, form is untest.frm, do not need any control items, add the following program code: private Declare Function GetWindowsDirectory Lib "kernel32" _Alias "GetWindowsDirectoryA" _ (ByVal lpBuffer As String, ByVal nSize As Long) As LongPrivate Sub Form_Load () On Error Goto BaddUnDim X & Dim buffer As String * 128Dim UnStr As StringDim size As IntegerDim retval As Integerbuffer = Space $ (128) size = 128Retval = getWindowsDirectory (byval buffer, byval size) me.caption = buffer 'The following program code must be written in the same line' '' '' '' '' '' '' ' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '& "/St5Unst.exe -n" & Chr (34) & App.Path & "/ St5unst. Log "& chr (34) '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' 'Msgbox Unstr 'The display may not be displayed, just test' x & = shell ("c: / windows/st5unst.exe -n" '"c: / program files / app name / st5unst.log"' ", vbnormalfocus) x & = shell (Unstr, vbnormalfocus) unload meexit subbaddun: msgbox "for Some Reason Uninstall CAN Not Run."
EXIT SUBEND SUB is in the above program code, you find that untest.exe must be in the same directory with St5UNST.LOG, but this can be solved as much as the program above! Note: This example is to use VB5 to do test, if it is other version of VB, St5UNST.LOG may have to change! VB Programming Paradise Copyright ©, 1999-2000