home *** CD-ROM | disk | FTP | other *** search
/ CD Direkt 1995 #1 / Image.iso / cdd / source / vbsource / makedisk / setup1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-11-17  |  16.0 KB  |  387 lines

  1. VERSION 2.00
  2. Begin Form Setup1 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00C00000&
  5.    BorderStyle     =   0  'None
  6.    Caption         =   "Test App Setup"
  7.    ClientHeight    =   3015
  8.    ClientLeft      =   3840
  9.    ClientTop       =   3000
  10.    ClientWidth     =   6210
  11.    ControlBox      =   0   'False
  12.    FillStyle       =   0  'Solid
  13.    FontBold        =   -1  'True
  14.    FontItalic      =   -1  'True
  15.    FontName        =   "MS Sans Serif"
  16.    FontSize        =   24
  17.    FontStrikethru  =   0   'False
  18.    FontUnderline   =   0   'False
  19.    ForeColor       =   &H00000000&
  20.    Height          =   3420
  21.    Icon            =   SETUP1.FRX:0000
  22.    Left            =   3780
  23.    LinkMode        =   1  'Source
  24.    LinkTopic       =   "Form3"
  25.    MaxButton       =   0   'False
  26.    MinButton       =   0   'False
  27.    ScaleHeight     =   201
  28.    ScaleMode       =   3  'Pixel
  29.    ScaleWidth      =   414
  30.    Top             =   2655
  31.    Width           =   6330
  32.    Begin Label Label2 
  33.       BorderStyle     =   1  'Fixed Single
  34.       Caption         =   "To customize this setup program, modify the FORM_LOAD event procedure in this form."
  35.       Height          =   435
  36.       Left            =   15
  37.       TabIndex        =   1
  38.       Top             =   15
  39.       Visible         =   0   'False
  40.       Width           =   5625
  41.    End
  42.    Begin Label Label1 
  43.       BorderStyle     =   1  'Fixed Single
  44.       Caption         =   "This label used for DDE connection to the Program Manager"
  45.       Height          =   390
  46.       Left            =   15
  47.       TabIndex        =   0
  48.       Top             =   525
  49.       Visible         =   0   'False
  50.       Width           =   5610
  51.    End
  52. 'Version = 1.00.002
  53. ' $$$ AppParam
  54. Const APPNAME = "UelbList"
  55. Const APPDIR = "C:\UELBLIST"
  56. Const fDataAccess% = False
  57. Const fODBC% = False
  58. Const fBtrieve% = False
  59. Const fOLE2% = False
  60. ' Set the total uncompressed file sizes
  61. ' by adding the sizes of the files
  62. ' $$$ AppSizes
  63. Const WINSYSNEEDED = 1424732
  64. Const OTHERNEEDED = 55319
  65. Sub DrawBackground ()
  66.     Setup1.CurrentY = 5
  67.     Setup1.CurrentX = 5
  68.     Setup1.ForeColor = QBColor(15)
  69.     Print AppName + " Setup"
  70. End Sub
  71. Sub Form_Load ()
  72.     '----------
  73.     ' Initialize
  74.     '----------
  75.     dialogCaption$ = AppName + " Setup"
  76.     ShowMainForm dialogCaption$
  77.     winDrive$ = UCase$(Left$(winDir$, 1))
  78.     winDir$ = UCase$(GetWindowsDir$())
  79.     winSysDir$ = UCase$(GetWindowsSysDir$())
  80.     '----------------------------------------------------
  81.     ' Get Window version
  82.     '----------------------------------------------------
  83.     TheVerInfo& = GetVersion()
  84.     WinVer& = TheVerInfo& And &HFFFF&
  85.     If Val(Format$(WinVer& Mod 256) + "." + Format$(WinVer& \ 256)) >= 3.1 Then
  86.     gfWin31% = True
  87.     End If
  88.     '----------------------------------------------------
  89.     ' OLE 2.0 requires Win 3.1 or greater
  90.     '----------------------------------------------------
  91.     If fOLE2% And Not gfWin31% Then
  92.     MsgBox "Dieses Programm ben
  93. tigt mindestens Windows 3.1."
  94.     GoTo ErrorSetup
  95.     End If
  96.     '----------------------------------------------------
  97.     ' SETUP.EXE passes the source drive in a command
  98.     ' argument.  If it is empty,  that means the user
  99.     ' executed this .exe directly.  In that case, show
  100.     ' a dialog to get the desired source directory.
  101.     '----------------------------------------------------
  102.     SourcePath$ = Command$
  103.     If SourcePath$ = "" Then
  104.     title$ = dialogCaption$
  105.     caption1$ = "Bitte geben Sie Laufwerk und Verzeichnis der " + AppName + "-Quelldateien ein."
  106.     caption2$ = "Installation von:"
  107.     defaultDrive$ = "A:"
  108.     defaultText$ = "A:\"
  109.     ShowPathDialog title$, caption1$, caption2$, defaultDrive$, defaultText$, SourcePath$, outButton$
  110.     If outButton$ = "exit" Then GoTo ErrorSetup
  111.     Else
  112.     If Right$(SourcePath$, 1) <> "\" Then
  113.         SourcePath$ = SourcePath$ + "\"
  114.     End If
  115.     End If
  116.     '--------------------
  117.     ' Get Destination Path
  118.     '--------------------
  119.     title$ = dialogCaption$
  120.     caption1$ = "Wenn Sie " & AppName & " in einem anderen Laufwerk oder Verzeichnis speichern wollen, geben Sie bitte den Pfad ein."
  121.     caption2$ = "Installation in:"
  122.     defaultDrive$ = "C:"
  123.     defaultText$ = APPDIR
  124.     ShowPathDialog title$, caption1$, caption2$, defaultDrive$, defaultText$, destPath$, outButton$
  125.     If outButton$ = "exit" Then GoTo ErrorSetup
  126.     '-----------------------------------------
  127.     ' Dim disk space variables as Long Integers
  128.     '-----------------------------------------
  129.     Dim winSpaceFree As Long
  130.     Dim sourceSpaceFree As Long
  131.     Dim destSpaceFree As Long
  132.     Dim totalNeeded As Long
  133.     '---------------------------------------------------------
  134.     ' If the Windows \SYSTEM directory is a subdirectory
  135.     ' of the Windows directory, the proper place for
  136.     ' installation of .VBXs and shared .DLLs is the
  137.     ' Windows \SYSTEM directory.
  138.     '
  139.     ' If the Windows \SYSTEM directory is *not* a subdirectory
  140.     ' of the Windows directory, then the user is running a
  141.     ' shared version of Windows, and the proper place for
  142.     ' installation of .VBXs and shared .DLLs is the
  143.     ' Windows directory.
  144.     '---------------------------------------------------------
  145.     If InStr(winSysDir$, winDir$) = 0 Then
  146.     winSysDir$ = winDir$
  147.     End If
  148.     '---------------------------------
  149.     ' Get Drive Letters of directories
  150.     '---------------------------------
  151.     destDrive$ = UCase$(Left$(destPath$, 1))
  152.     sourceDrive$ = UCase$(Left$(SourcePath$, 1))
  153.     '---------------------------------
  154.     ' Compute free disk space variables
  155.     '---------------------------------
  156.     winSpaceFree = GetDiskSpaceFree(winDrive$)
  157.     destSpaceFree = GetDiskSpaceFree(destDrive$)
  158.     '-----------------------------------------
  159.     ' Check for enough disk space.
  160.     '
  161.     ' Some components are being installed into the
  162.     ' Windows\SYSTEM directory.
  163.     '
  164.     ' So if the main destination path is on a
  165.     ' different drive than the drive with
  166.     ' the Windows \SYSTEM directory, we have to
  167.     ' check both drives.
  168.     '
  169.     ' An example of this is when the user is installing
  170.     ' the main product to drive D:, but the Windows
  171.     ' directory is on drive c:
  172.     ' -----------------------------------------
  173.     totalNeeded = WINSYSNEEDED + OTHERNEEDED
  174.     If winDrive$ = destDrive$ Then
  175.     If destSpaceFree < totalNeeded Then
  176.         MsgBox "Zu wenig freier Speicherplatz auf Laufwerk " + destDrive$ + ":" + CRLF + "Ca. " + Str$(totalNeeded - destSpaceFree) + " zus
  177. tzliche Bytes werden ben
  178. tigt.", 16, dialogCaption$
  179.         GoTo ErrorSetup
  180.     End If
  181.     Else
  182.     If winSpaceFree < WINSYSNEEDED Then
  183.         MsgBox "Zu wenig freier Speicherplatz auf Laufwerk " + winDrive$ + ":" + CRLF + "Ca. " + Str$(WINSYSNEEDED - winSpaceFree) + " zus
  184. tzliche Bytes werden ben
  185. tigt.", 16, dialogCaption$
  186.         GoTo ErrorSetup
  187.     End If
  188.     If destSpaceFree < OTHERNEEDED Then
  189.         MsgBox "Zu wenig freier Speicherplatz auf Laufwerk " + destDrive$ + ":" + CRLF + "Ca. " + Str$(OTHERNEEDED - destSpaceFree) + " zus
  190. tzliche Bytes werden ben
  191. tigt."", 16, dialogCaption$"
  192.         GoTo ErrorSetup
  193.     End If
  194.     End If
  195.     '----------------------------
  196.     ' Create destination directory
  197.     '----------------------------
  198.     If Not CreatePath(destPath$) Then GoTo ErrorSetup
  199.     '-----------------------------------------------------------
  200.     ' Show Status Dialog -- This stays up while copying files
  201.     ' It is required by the CopyFile routine
  202.     '-----------------------------------------------------------
  203.     ShowStatusDialog dialogCaption$, totalNeeded
  204.     '-----------
  205.     ' Copy Files
  206.     '-----------
  207.     ' Test to see if loan.exe is on the disk, if not then you know the user
  208.     ' did not insert the first disk
  209.     ' $$$ DiskStart
  210.     If Not PromptForNextDisk(1, SourcePath$ + "UELBLIST.EX_") Then GoTo ErrorSetup
  211.     If Not CopyFile(SourcePath$, destpath$, "UELBLIST.EX_", "UELBLIST.EXE") Then GoTo ErrorSetup
  212.     If Not CopyFile(SourcePath$, destpath$, "UELBLIST.HL_", "UELBLIST.HLP") Then GoTo ErrorSetup
  213.     If Not CopyFile(SourcePath$, winSysDir$, "SHARE.EX_", "SHARE.EXE") Then GoTo ErrorSetup
  214.     If Not CopyFile(SourcePath$, winSysDir$, "CMDIALOG.VB_", "CMDIALOG.VBX") Then GoTo ErrorSetup
  215.     If Not CopyFile(SourcePath$, winSysDir$, "MHGFRM.VB_", "MHGFRM.VBX") Then GoTo ErrorSetup
  216.     If Not CopyFile(SourcePath$, winSysDir$, "MHGLBL.VB_", "MHGLBL.VBX") Then GoTo ErrorSetup
  217.     If Not CopyFile(SourcePath$, winSysDir$, "MHGMUL.VB_", "MHGMUL.VBX") Then GoTo ErrorSetup
  218.     If Not CopyFile(SourcePath$, winSysDir$, "MSAES110.DL_", "MSAES110.DLL") Then GoTo ErrorSetup
  219.     If Not PromptForNextDisk(2, SourcePath$ + "MSAJT110.DL_") Then GoTo ErrorSetup
  220.     If Not CopyFile(SourcePath$, winSysDir$, "MSAJT110.DL_", "MSAJT110.DLL") Then GoTo ErrorSetup
  221.     If Not CopyFile(SourcePath$, winSysDir$, "THREED.VB_", "THREED.VBX") Then GoTo ErrorSetup
  222.     ' $$$ DiskEnd
  223.     ' If you have more than one distribution disk, call PromptForNextDisk after
  224.     ' you have installed all the files from the previous disk. This line tests to
  225.     ' see if foo.da_ is on disk 2. If not, you know the user has not inserted disk 2.
  226.     ' The call to PromptForNextDisk is commented out, since loan.exe can be installed
  227.     ' from a single distribution disk.
  228.     ' If Not PromptForNextDisk(2, SourcePath$ + "foo.da_") Then GoTo ErrorSetup
  229.     ' If Not CopyFile(SourcePath$, destPath$, "foo.da_", "foo.dat", 0) Then GoTo ErrorSetup
  230.     '--------------------------------------------------
  231.     ' File Copying is over, so unload the status dialog
  232.     '--------------------------------------------------
  233.     Unload StatusDlg
  234.     '-----------------------------------------------------------
  235.     ' Show static message while working on DDE to Program Manager
  236.     '-----------------------------------------------------------
  237.     ShowStaticMessageDialog dialogCaption$, "Erstelle Programmgruppe im Programm-Manager..."
  238.     '--------------------------------------
  239.     ' Create program manager group and icon
  240.     '--------------------------------------
  241.     ' $$$ ProgManStart
  242.     CreateProgManGroup Setup1, "UelbList", "UelbList.GRP"
  243.     CreateProgManItem Setup1, destPath$ + "UELBLIST.EXE", "UeLB - Listenkonvertierer"
  244.     CreateProgManItem Setup1, destPath$ + "UELBLIST.HLP", "Infos zum UeLB - Listenkonverter"
  245.     ' $$$ ProgManEnd
  246.     '-------------------------------------------------
  247.     ' Since SETUP.EXE copies your setup program to the Windows
  248.     ' directory, it is possible for your user to
  249.     ' execute this program directly.
  250.     '
  251.     ' As a usability feature, you may wish to insert code
  252.     ' here to install a program manager icon that executes
  253.     ' your setup program in the windows drive.  This
  254.     ' allows th user to re-run setup at a later time to
  255.     ' install options that were not installed the first
  256.     ' time.
  257.     '-------------------------------------------------
  258.     ' $$$ INIStart
  259.     x% = WritePrivateProfileString("Pfade", "Arbeitsverzeichnis", destpath$, "UELBLIST.INI")
  260.     ' $$$ INIEnd
  261.     '-------------------
  262.     ' Hide Static Message
  263.     '-------------------
  264.     MessageDlg.Hide
  265.     '--------------------------------------------------------------
  266.     ' If OLE2.DLL already exists, then ignore the OLE 2 flag.
  267.     ' Otherwise, if we are installing an application that uses
  268.     ' OLE 2.0, we need to register the OLE 2 DLL's via REGEDIT.EXE.
  269.     '
  270.     ' Do not copy OLE dlls unless you check the versions and assure
  271.     ' that the versions you plan to install postdate the ones on
  272.     ' the users machine.
  273.     '
  274.     '
  275.     ' The data access engine and OLE 2.0 need to have SHARE.EXE
  276.     ' loaded. Check AUTOEXEC.BAT and add if needed.  NOTE: If
  277.     ' running Window For WorkGroup, then do not add SHARE.  WFW
  278.     ' use its own sharing mechanism, VSHARE.386.
  279.     '----------------------------------------------------------
  280.     If fDataAccess% Or fOLE2% And Not FileExists(winSysDir$ + "\" + "OLE2.DLL") Then
  281.     ret$ = Space$(255)
  282.     x% = GetPrivateProfileString("BOOT", "NETWORK.DRV", "", ret$, Len(ret$), "SYSTEM.INI")
  283.     If x% Then ret$ = Left(ret$, x%)
  284.     If InStr(1, UCase$(ret$), "WFWNET.DRV") = 0 Then
  285.         AddShareIfNeeded winSysDir$, "SHARE.EXE"
  286.     End If
  287.     End If
  288.     '----------------------------
  289.     ' Need to register OLE 2.0 dlls
  290.     '----------------------------
  291.     If fOLE2% And Not FileExists(winSysDir$ + "\" + "OLE2.DLL") Then
  292.     x% = Shell("regedit /s ole2.reg")
  293.     End If
  294.     '-------------------------------------------------------
  295.     ' Do not change this if statement.  Used by Setup Wizard
  296.     '-------------------------------------------------------
  297.     If fODBC% Then
  298.     CreateProgManItem Setup1, destPath$ + "ODBCADM.EXE", "ODBC Administrator"
  299.     MsgBox "Before you can run a Visual Basic ODBC application using the SQL Server driver, you must first update the ODBC catalog of stored procedures.  These procedures are provided in the INSTCAT.SQL file.  Typically, the system administrator for SQL Server should install these procedures, using the SQL Server ISQL utility."
  300.     End If
  301.     '-------------------------------------------------------
  302.     ' Do not change this if statement.  Used by Setup Wizard
  303.     '-------------------------------------------------------
  304.     If fBtrieve% Then
  305.     ' See notes in Appendix C
  306.     retstr$ = String$(255, 32)
  307.     x% = GetPrivateProfileString%("BTRIEVE", "OPTIONS", "1", retstr$, Len(retstr$), "WIN.INI")
  308.     If x% <= 1 Then
  309.         x% = WritePrivateProfileString%("BTRIEVE", "OPTIONS", "/m:64 /p:4096 /b:16 /f:20 /l:40 /n:12 /t:" + destPath$ + "BTRIEVE.TRN", "WIN.INI")
  310.     End If
  311.     End If
  312.     '------------------
  313.     ' Show Final message
  314.     '------------------
  315.     MsgBox "Die Installation von " + AppName + " wurde erfolgreich beendet.", 48, dialogCaption$
  316. ExitSetup:
  317.     Setup1.Hide
  318.     RestoreProgMan         'Show the program manager
  319.     End
  320.     Exit Sub
  321. ErrorSetup:
  322.     MsgBox AppName + " ist nicht vollst
  323. ndig installiert. Bitte wiederholen Sie das Setup-Programm, bevor Sie " + AppName + " starten.", 48, dialogCaption$
  324.     ChDrive winDrive$   ' Set back to hard disk
  325.     ChDir Left$(winDir$, Len(winDir$) - 1)
  326.     End
  327.     Exit Sub
  328. End Sub
  329. Sub Form_Paint ()
  330.     DrawBackground
  331. End Sub
  332. '---------------------------------------------------------------
  333. ' Sets the form's caption, Paints 3-D Background Text, Shows Form
  334. '---------------------------------------------------------------
  335. Sub ShowMainForm (Caption$)
  336.     Screen.MousePointer = 11
  337.     Setup1.Caption = Caption$
  338.     Setup1.Move 0, 0, Screen.Width, Screen.Height
  339.     Setup1.Show
  340.     Setup1.Refresh
  341.     Setup1.ScaleMode = 2
  342.     Setup1.FontSize = 24
  343.     Setup1.FontBold = True
  344.     Setup1.FontItalic = True
  345.     DrawBackground
  346. End Sub
  347. Sub ShowPathDialog (title$, caption1$, caption2$, defaultDrive$, defaultText$, SourcePath$, outButton$)
  348.     Screen.MousePointer = 11
  349.     Load PathDlg
  350.     PathDlg.Caption = title$
  351.     PathDlg.Label1.Caption = caption1$
  352.     PathDlg.Label2.Caption = caption2$
  353.     PathDlg.inDrive.Tag = defaultDrive$
  354.     PathDlg.Text1.Text = defaultText$
  355.     PathDlg.Text1.SelStart = 0
  356.     PathDlg.Text1.SelLength = Len(defaultText$)
  357.     If Left$(defaultText$, 1) = "A" Or Left$(defaultText$, 1) = "B" Then
  358.         PathDlg.diskpict.Visible = True
  359.         PathDlg.hddpict.Visible = False
  360.     Else
  361.         PathDlg.diskpict.Visible = False
  362.         PathDlg.hddpict.Visible = True
  363.     End If
  364.     CenterForm PathDlg
  365.     DoEvents
  366.     Screen.MousePointer = 0
  367.     PathDlg.Show 1
  368.     SourcePath$ = PathDlg.outPath.Tag
  369.     outButton$ = PathDlg.outButton.Tag
  370.     Unload PathDlg
  371. End Sub
  372. Sub ShowStaticMessageDialog (title$, Caption$)
  373.     Load MessageDlg
  374.     CenterForm MessageDlg
  375.     MessageDlg.Caption = title$
  376.     MessageDlg.Label.Caption = Caption$
  377.     MessageDlg.Show
  378.     MessageDlg.Refresh
  379. End Sub
  380. Sub ShowStatusDialog (title$, totalBytes As Long)
  381.     Load StatusDlg
  382.     StatusDlg.Caption = title$
  383.     StatusDlg.total.Tag = Str$(totalBytes)
  384.     CenterForm StatusDlg
  385.     StatusDlg.Show
  386. End Sub
  387.