home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / xceedzip / FRMSFX.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-04-26  |  14.2 KB  |  390 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmSfx 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Self-extracting zip file options"
  6.    ClientHeight    =   5205
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   8280
  10.    ControlBox      =   0   'False
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   5205
  15.    ScaleWidth      =   8280
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.ComboBox cmbSelfBinModule 
  18.       Enabled         =   0   'False
  19.       Height          =   315
  20.       ItemData        =   "frmSfx.frx":0000
  21.       Left            =   2400
  22.       List            =   "frmSfx.frx":0002
  23.       Style           =   2  'Dropdown List
  24.       TabIndex        =   1
  25.       Top             =   690
  26.       Width           =   1935
  27.    End
  28.    Begin VB.CommandButton cmdIcon 
  29.       Caption         =   "Browse"
  30.       Height          =   285
  31.       Left            =   6000
  32.       TabIndex        =   8
  33.       Top             =   4440
  34.       Width           =   735
  35.    End
  36.    Begin VB.TextBox txtIcon 
  37.       Height          =   285
  38.       Left            =   2280
  39.       TabIndex        =   9
  40.       Top             =   4800
  41.       Width           =   3615
  42.    End
  43.    Begin VB.CommandButton cmbReadme 
  44.       Caption         =   "Browse"
  45.       Height          =   285
  46.       Left            =   6000
  47.       TabIndex        =   6
  48.       Top             =   4050
  49.       Width           =   735
  50.    End
  51.    Begin VB.TextBox txtReadme 
  52.       Height          =   285
  53.       Left            =   2280
  54.       TabIndex        =   7
  55.       Top             =   4440
  56.       Width           =   3615
  57.    End
  58.    Begin VB.TextBox txtDefaultFolder 
  59.       Height          =   285
  60.       Left            =   2280
  61.       TabIndex        =   5
  62.       Top             =   4050
  63.       Width           =   3615
  64.    End
  65.    Begin VB.Frame fraStrings 
  66.       Caption         =   "Strings and Messages"
  67.       BeginProperty Font 
  68.          Name            =   "MS Sans Serif"
  69.          Size            =   8.25
  70.          Charset         =   0
  71.          Weight          =   700
  72.          Underline       =   0   'False
  73.          Italic          =   0   'False
  74.          Strikethrough   =   0   'False
  75.       EndProperty
  76.       Height          =   2695
  77.       Left            =   120
  78.       TabIndex        =   11
  79.       Top             =   1200
  80.       Width           =   6615
  81.       Begin VB.TextBox txtIntro 
  82.          Height          =   885
  83.          Left            =   2160
  84.          MultiLine       =   -1  'True
  85.          ScrollBars      =   2  'Vertical
  86.          TabIndex        =   3
  87.          Top             =   720
  88.          Width           =   4335
  89.       End
  90.       Begin VB.TextBox txtSuccess 
  91.          Height          =   885
  92.          Left            =   2160
  93.          MultiLine       =   -1  'True
  94.          ScrollBars      =   2  'Vertical
  95.          TabIndex        =   4
  96.          Top             =   1680
  97.          Width           =   4335
  98.       End
  99.       Begin VB.TextBox txtSWindowTitle 
  100.          Height          =   285
  101.          Left            =   2160
  102.          TabIndex        =   2
  103.          Top             =   360
  104.          Width           =   4335
  105.       End
  106.       Begin VB.Label lbIntro 
  107.          Caption         =   "Introduction message:"
  108.          Height          =   255
  109.          Left            =   120
  110.          TabIndex        =   19
  111.          Top             =   720
  112.          Width           =   1815
  113.       End
  114.       Begin VB.Label lblSuccess 
  115.          Caption         =   "Success message:"
  116.          Height          =   255
  117.          Left            =   120
  118.          TabIndex        =   18
  119.          Top             =   1680
  120.          Width           =   1455
  121.       End
  122.       Begin VB.Label lblWindowTitle 
  123.          Caption         =   "Self-extracting zip file's title:"
  124.          Height          =   255
  125.          Left            =   120
  126.          TabIndex        =   13
  127.          Top             =   360
  128.          Width           =   2175
  129.       End
  130.    End
  131.    Begin MSComDlg.CommonDialog dlgSelect 
  132.       Left            =   7680
  133.       Top             =   4680
  134.       _ExtentX        =   847
  135.       _ExtentY        =   847
  136.       _Version        =   393216
  137.    End
  138.    Begin VB.CommandButton cmdOk 
  139.       Caption         =   "&OK"
  140.       Height          =   375
  141.       Left            =   6930
  142.       TabIndex        =   10
  143.       Top             =   150
  144.       Width           =   1215
  145.    End
  146.    Begin VB.CheckBox chkMakeSfx 
  147.       Caption         =   "Create a &self-extracting zip file"
  148.       Height          =   255
  149.       Left            =   120
  150.       TabIndex        =   0
  151.       Top             =   240
  152.       Width           =   3135
  153.    End
  154.    Begin VB.CommandButton cmdCancel 
  155.       Cancel          =   -1  'True
  156.       Caption         =   "&Cancel"
  157.       Height          =   375
  158.       Left            =   6930
  159.       TabIndex        =   12
  160.       Top             =   600
  161.       Width           =   1215
  162.    End
  163.    Begin VB.Label lblBinModule 
  164.       Caption         =   "Type of self-extracting zip file:"
  165.       Enabled         =   0   'False
  166.       Height          =   255
  167.       Left            =   120
  168.       TabIndex        =   17
  169.       Top             =   720
  170.       Width           =   2295
  171.    End
  172.    Begin VB.Label lblIcon 
  173.       Caption         =   "SFX file's icon:"
  174.       Height          =   255
  175.       Left            =   120
  176.       TabIndex        =   16
  177.       Top             =   4800
  178.       Width           =   1935
  179.    End
  180.    Begin VB.Label lblReadme 
  181.       Caption         =   "Readme file to display:"
  182.       Height          =   255
  183.       Left            =   120
  184.       TabIndex        =   15
  185.       Top             =   4440
  186.       Width           =   2055
  187.    End
  188.    Begin VB.Label lblDefaultUnzipFolder 
  189.       Caption         =   "Default folder to unzip files to:"
  190.       Height          =   255
  191.       Left            =   120
  192.       TabIndex        =   14
  193.       Top             =   4080
  194.       Width           =   2415
  195.    End
  196. Attribute VB_Name = "frmSfx"
  197. Attribute VB_GlobalNameSpace = False
  198. Attribute VB_Creatable = False
  199. Attribute VB_PredeclaredId = True
  200. Attribute VB_Exposed = False
  201. Option Explicit
  202. '=============================================================================
  203. ' Description: The frmSfx form lets the user customize some of Xceed Zip's
  204. '              Self-Extractor Module's settings.
  205. '=============================================================================
  206. '-----------------------------------------------------------------------------
  207. ' Displays the form, initializes its controls values and loads them to
  208. ' XceedZip's properties if OK is clicked.
  209. '-----------------------------------------------------------------------------
  210. Public Function ShowForm(xZip As XceedZip) As Boolean
  211.   Me.Tag = "0"
  212.   Call InitializeForm(xZip)
  213.   Me.Show vbModal
  214.   If chkMakeSfx.Value = vbUnchecked Then
  215.     Me.Tag = "0"
  216.   End If
  217.   If Me.Tag = "1" Then
  218.     Call LoadDatatoXceedZip(xZip)
  219.   Else
  220.     xZip.SfxBinaryModule = ""
  221.   End If
  222.   ShowForm = (frmSfx.Tag = "1")
  223. End Function
  224. '-----------------------------------------------------------------------------
  225. ' If cancel is clicked, tag stays at "0" and the form is hidden
  226. '-----------------------------------------------------------------------------
  227. Private Sub cmdCancel_Click()
  228.     Me.Hide
  229. End Sub
  230. '-----------------------------------------------------------------------------
  231. ' Opens a Dialog Box permitting the user to choose the icon file.
  232. '-----------------------------------------------------------------------------
  233. Private Sub cmdIcon_Click()
  234.           Dim sSelectedFile As String
  235.            
  236.            With Me.dlgSelect
  237.             .FileName = ""
  238.             .Flags = cdlOFNFileMustExist + cdlOFNNoChangeDir + cdlOFNHideReadOnly
  239.             .Filter = "Icon files (*.ico)|*.ico"
  240.             .MaxFileSize = 32000
  241.             .DialogTitle = "Select icon file"
  242.             .InitDir = App.Path
  243.             .Action = 1
  244.            End With
  245.         
  246.     If dlgSelect.FileName <> "" Then
  247.         txtIcon.Text = dlgSelect.FileName
  248.     End If
  249. End Sub
  250. '-----------------------------------------------------------------------------
  251. ' The MakeSfx checkbox is clicked and is the value is "unchecked", the controls
  252. ' on the form are disabled. In the value is "checked", the controls on the form
  253. ' are enabled.
  254. '-----------------------------------------------------------------------------
  255. Private Sub chkMakeSfx_Click()
  256.     If chkMakeSfx.Value = vbUnchecked Then
  257.         Call DisableAll
  258.     Else
  259.         Call EnableAll
  260.     End If
  261. End Sub
  262. '-----------------------------------------------------------------------------
  263. ' Ok is pressed and Tag takes the "1" value. The form is then hidden.
  264. '-----------------------------------------------------------------------------
  265. Private Sub cmdOk_Click()
  266.     Me.Tag = "1"
  267.     Me.Hide
  268. End Sub
  269. '-----------------------------------------------------------------------------
  270. ' Opens a Dialog Box permitting the user to choose the readme file.
  271. '-----------------------------------------------------------------------------
  272. Private Sub cmbReadme_Click()
  273.           Dim sSelectedFile As String
  274.            
  275.            With Me.dlgSelect
  276.             .FileName = ""
  277.             .Flags = cdlOFNFileMustExist + cdlOFNNoChangeDir + cdlOFNHideReadOnly
  278.             .Filter = "Readme files (*.txt)|*.txt"
  279.             .MaxFileSize = 32000
  280.             .DialogTitle = "Select readme file"
  281.             .InitDir = App.Path
  282.             .Action = 1
  283.            End With
  284.         
  285.     If dlgSelect.FileName <> "" Then
  286.         txtReadme.Text = dlgSelect.FileName
  287.     End If
  288. End Sub
  289. '-----------------------------------------------------------------------------
  290. ' Disables all the controls on the form
  291. '-----------------------------------------------------------------------------
  292. Private Sub DisableAll()
  293.     cmbSelfBinModule.Enabled = False
  294.     txtSWindowTitle.Enabled = False
  295.     txtSWindowTitle.BackColor = &H8000000F
  296.     txtSuccess.Enabled = False
  297.     txtSuccess.BackColor = &H8000000F
  298.     txtIntro.Enabled = False
  299.     txtIntro.BackColor = &H8000000F
  300.     txtDefaultFolder.Enabled = False
  301.     txtDefaultFolder.BackColor = &H8000000F
  302.     txtReadme.Enabled = False
  303.     txtReadme.BackColor = &H8000000F
  304.     cmbReadme.Enabled = False
  305.     txtIcon.Enabled = False
  306.     txtIcon.BackColor = &H8000000F
  307.     cmdIcon.Enabled = False
  308. End Sub
  309. '-----------------------------------------------------------------------------
  310. ' Enables all the controls on the form.
  311. '-----------------------------------------------------------------------------
  312. Private Sub EnableAll()
  313.     cmbSelfBinModule.Enabled = True
  314.     txtSWindowTitle.Enabled = True
  315.     txtSWindowTitle.BackColor = &H80000005
  316.     txtSuccess.Enabled = True
  317.     txtSuccess.BackColor = &H80000005
  318.     txtIntro.Enabled = True
  319.     txtIntro.BackColor = &H80000005
  320.     txtDefaultFolder.Enabled = True
  321.     txtDefaultFolder.BackColor = &H80000005
  322.     txtReadme.Enabled = True
  323.     txtReadme.BackColor = &H80000005
  324.     cmbReadme.Enabled = True
  325.     txtIcon.Enabled = True
  326.     txtIcon.BackColor = &H80000005
  327.     cmdIcon.Enabled = True
  328. End Sub
  329. '-----------------------------------------------------------------------------
  330. ' Initializes the Binary module combo box
  331. '-----------------------------------------------------------------------------
  332. Private Sub InitializeBinModuleCombo(xZip As XceedZip)
  333.     cmbSelfBinModule.AddItem ("16-bit Self-Extractor")
  334.     cmbSelfBinModule.AddItem ("32-bit Self-Extractor")
  335.     cmbSelfBinModule.Text = cmbSelfBinModule.List(1)
  336. End Sub
  337. '-----------------------------------------------------------------------------
  338. ' Inializes the form with XceedZip's values
  339. '-----------------------------------------------------------------------------
  340. Private Sub InitializeForm(xZip As XceedZip)
  341.     If xZip.SfxBinaryModule = "" Then
  342.         chkMakeSfx.Value = vbUnchecked
  343.         DisableAll
  344.     Else
  345.         chkMakeSfx.Value = vbChecked
  346.         EnableAll
  347.     End If
  348.     Call InitializeBinModuleCombo(xZip)
  349.     Call InitializeStringsAndMessages(xZip)
  350.     txtDefaultFolder.Text = xZip.SfxDefaultUnzipToFolder
  351.     txtReadme.Text = xZip.SfxReadmeFile
  352.     txtIcon.Text = xZip.SfxIconFilename
  353. End Sub
  354. '-----------------------------------------------------------------------------
  355. ' Initializes the strings and messages controls with XceedZip's values.
  356. '-----------------------------------------------------------------------------
  357. Private Sub InitializeStringsAndMessages(xZip As XceedZip)
  358.     txtSWindowTitle.Text = xZip.SfxStrings(xssTitle)
  359.     txtSuccess.Text = xZip.SfxMessages(xsmSuccess)
  360.     txtIntro.Text = xZip.SfxMessages(xsmIntro)
  361. End Sub
  362. '-----------------------------------------------------------------------------
  363. ' Calls functions to load the form's control values to XceedZip's properties.
  364. '-----------------------------------------------------------------------------
  365. Private Sub LoadDatatoXceedZip(xZip As XceedZip)
  366.     Call LoadSelfExtractBinModule(xZip)
  367.     Call LoadMessagesAndStrings(xZip)
  368.     xZip.SfxDefaultUnzipToFolder = txtDefaultFolder.Text
  369.     xZip.SfxReadmeFile = txtReadme.Text
  370. End Sub
  371. '-----------------------------------------------------------------------------
  372. ' Loads XceedZip's Message and Strings values to the control values.
  373. '-----------------------------------------------------------------------------
  374. Private Sub LoadMessagesAndStrings(xZip As XceedZip)
  375.     xZip.SfxStrings(xssTitle) = txtSWindowTitle.Text
  376.     xZip.SfxMessages(xsmSuccess) = txtSuccess.Text
  377.     xZip.SfxMessages(xsmIntro) = txtIntro.Text
  378.     xZip.SfxIconFilename = txtIcon.Text
  379. End Sub
  380. '-----------------------------------------------------------------------------
  381. ' Loads the appropriate self-extracting binary module from the combo box.
  382. '-----------------------------------------------------------------------------
  383. Private Sub LoadSelfExtractBinModule(xZip As XceedZip)
  384.     If cmbSelfBinModule.ListIndex = 0 Then
  385.         xZip.SfxBinaryModule = App.Path & "\..\..\..\Sfx\Xcdsfx16.bin"
  386.     Else
  387.         xZip.SfxBinaryModule = App.Path & "\..\..\..\Sfx\Xcdsfx32.bin"
  388.     End If
  389. End Sub
  390.