Launching a Sub-Installer
Let's suppose you want to launch a sub-installer, which will install certain DLLs or components - Microsoft Agent, for example. You want that sub-installer to be launched before the setup copies its files. Here's what to do...
- In the code of frmBegin's cmdInstall, change this:
Private Sub cmdInstall_Click() If IsValidDestDir(gstrDestDir) = True Then Unload Me DoEvents End IfEnd Sub
...to this...
Private Sub cmdInstall_Click() If IsValidDestDir(gstrDestDir) = True Then Shell GetWindowsDir & "myexe.exe" DoEvents ' Release the pressure off the processor. Unload Me DoEvents End IfEnd Sub
Now, this is what to do after the P&D Wizard creates your package:
- Open setup.lst in Notepad
Setup.lst has a [BootStrap] Section. It will look something like this:
[Bootstrap Files]
File1=@VB6STKIT.DLL,$(WinSysPathSysFile),,,3/26/99 12:00:00 AM,101888,6.0.84.50
File2=@COMCAT.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,5/31/98 12:00:00 AM,22288,4.71.1460.1
File3=@STDOLE2.TLB,$(WinSysPathSysFile),$(TLBRegister),,6/8/99 7:44:36 AM,17920,2.40.4276.1
File4=@ASYCFILT.DLL,$(WinSysPathSysFile),,,6/8/99 7:44:36 AM,143632,2.40.4276.1
File5=@olepro32.dll,$(WinSysPathSysFile),$(DLLSelfRegister),,6/7/99 1:37:36 AM,164112,5.0.4275.1
File6=@OLEAUT32.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,6/8/99 7:44:36 AM,598288,2.40.4276.1
File7=@MSVBVM60.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,5/10/99 12:00:00 AM,1384448,6.0.84.95
- Add another line below the above:
File8=@MYEXE.EXE,$(WinPath),,,[EXE_Date] [EXE_Time],[EXE_Size],[EXE_Version]
Note: There is no comma, just a space between [EXE_Date] & [EXE_Time]! Be careful with that...
When packaging the setup in the P&D Wizard, be sure to add myexe.exe to the package! Fill in the info as stated in the line, which is: the EXE's Date, time, size and version. All must be exact.
Top Tip: Suicidal Win2k users, change the date from 1/1/11 to 1.1.11 At least you'll survive one error.
Shell command to execute scripts or such. Refer to the VB-World tips section or the VB help file for further information. Just add them to the setup.lst (Bootstrap File) file in the BootStrap Section.
Top Tip: If you don't want the user to see the sub-installer, use Shell [command_line], vbHide
Just make sure they're put in the frmBegin's cmdInstall_Click() code and followed by a DoEvents otherwise if the sub-installer is very memory consuming or is hogging the system's resources, the system may go very slow or cause crashes.
If you remember, we added NetCheck to setup1.vbp in Part 1 of this article. You can use the ITC (Internet Transfer Control) to download a file from the Net if your user wants to. For example, you may give him/her a Command Button, which if clicked downloads some EXEs or other installers from the net.
If you're not distributing over the Net, then it might be a problem to those without such a connection! So beware
Page 3 of 7
This article was originally published on November 20, 2002