'------------------------------------ 'Initialize all variables here '------------------------------------ Prognam$ = "" defdrivesrc$ = "A:" defpathsrc$ = "A:\" defdrivedes$ = "C:" defpathdes$ = "C:\PATH" proggrp$ = "FILENAME.GRP" numprog = "1" ReDim progexe$(1 To numprog) ReDim progtitle$(1 To numprog) progexe$(1) = "FILENAME.EXE" progtitle$(1) = "TITLE" Dim winSpaceFree as Long Dim sourceSpaceFree as Long Dim destSpaceFree as Long Dim totalNeeded as Long Dim otherneeded as Long Dim winSysNeeded as Long winSysNeeded = 999999 otherneeded = 999999 totalNeeded = 1999998 dialogCaption$ = prognam$ + " Setup" ShowMainForm dialogCaption$ sourcepath$ = Command$ If sourcepath$ = "" Then title$ = dialogCaption$ caption1$ = "Please enter the drive or path containing the " + prognam$ + "Application source files." caption2$ = "Install From:" defaultDrive$ = defdrivesrc$ defaultText$ = defpathsrc$ ShowPathDialog title$, caption1$, caption2$, defaultDrive$, defaultText$, sourcepath$, outButton$ If outButton$ = "exit" Then GoTo errorsetup Else If Right$(sourcepath$, 1) <> "\" Then sourcepath$ = sourcepath$ + "\" End If End If title$ = dialogCaption$ caption1$ = "If you want to install " + prognam$ + " in a different directory and/or drive, type the name of the directory." caption2$ = "Install To:" defaultDrive$ = defdrivedes$ defaultText$ = defpathdes$ ShowPathDialog title$, caption1$, caption2$, defaultDrive$, defaultText$, destPath$, outButton$ If outButton$ = "exit" Then GoTo errorsetup winDir$ = GetWindowsDir$() winsysdir$ = GetWindowsSysDir$() If InStr(winsysdir$, winDir$) = 0 Then winsysdir$ = winDir$ End If winDrive$ = UCase$(Left$(winDir$, 1)) destDrive$ = UCase$(Left$(destPath$, 1)) sourceDrive$ = UCase$(Left$(sourcepath$, 1)) winSpaceFree = GetDiskSpaceFree(winDrive$) destSpaceFree = GetDiskSpaceFree(destDrive$) If winDrive$ = destDrive$ Then If destSpaceFree < totalNeeded Then MsgBox "There is not enough disk space on drive " + destDrive$ + ": An estimated" + Str$(totalNeeded - destSpaceFree) + " additional bytes are needed.", 16, dialogCaption$ GoTo errorsetup End If Else If winSpaceFree < winSysNeeded Then MsgBox "There is not enough disk space on drive " + winDrive$ + ": An estimated" + Str$(winSysNeeded - winSpaceFree) + " additional bytes are needed.", 16, dialogCaption$ GoTo errorsetup End If If destSpaceFree < otherneeded Then MsgBox "There is not enough disk space on drive " + destDrive$ + ": An estimated" + Str$(otherneeded - destSpaceFree) + " additional bytes are needed.", 16, dialogCaption$ GoTo errorsetup End If End If If Not CreatePath(destPath$) Then GoTo errorsetup ShowStatusDialog dialogCaption$, totalNeeded hinum = 0 noitems = 0 ReDIm item$(1 to hinum, 1 to noitems) ReDim noitem(1 to hinum) For xxx = 1 To hinum For yyy = 1 To noitem(xxx) itemm$ = RTrim$(item$(xxx, yyy)) lngth = Len(itemm$) itemm$ = Right$(itemm$, lngth - 3) If UCase$(Right$(itemm$, 3)) = "VBX" Or UCase$(Right$(itemm$, 3)) = "DLL" Then dest$ = winsysdir$ Else dest$ = destpath$ End If If UCase$(rtrim$(ltrim$(itemm$))) = "SETUPKIT.DLL" Then dest$ = destpath$ End If If Not CopyFile(sourcepath$, dest$, itemm$, 0) Then GoTo errorsetup Next yyy If hinum > 1 and xxx <> hinum Then title$ = prognam$ + " Setup" msg$ = "Please insert Disk # " + LTrim$(Str$(xxx + 1)) + "on " + sourcepath$ r% = MsgBox(msg$, 36, title$) If r% <> 6 Then GoTo errorsetup End If End If Next xxx If hinum > 1 Then title$ = prognam$ + " Setup" msg$ = "Please insert the Setup Disk # 1 in " + sourcepath$ r% = MsgBox(msg$, 36, title$) If r% <> 6 Then GoTo errorsetup End If End If complete: Unload StatusDlg ShowStaticMessageDialog dialogCaption$, " Creating Program Manager Icon..." CreateProgManGroup setup1, prognam$, proggrp$ For numicon = 1 To numprog CreateProgManItem setup1, destPath$ + progexe$(numicon), progtitle$(numicon) Next numicon MessageDlg.Hide msg$ = prognam$ + " Installation is complete!" MsgBox msg$, 48, dialogCaption$ ExitSetup: setup1.Hide RestoreProgMan Unload setup1 End Exit Sub errorsetup: msg$ = prognam$ + "is not properly installed. Please re-run setup at a later time to install the" + prognam$ + " Application properly." MsgBox msg$, 48, dialogCaption$ Unload setup1 Exit Sub End