home *** CD-ROM | disk | FTP | other *** search
/ Freelog 1 / Freelog001.iso / Logs / Graphism / JpgStrip / source / frmMain.frm (.txt) next >
Visual Basic Form  |  1998-10-13  |  7KB  |  233 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    Caption         =   "JpgStrip"
  4.    ClientHeight    =   4170
  5.    ClientLeft      =   2595
  6.    ClientTop       =   4185
  7.    ClientWidth     =   4785
  8.    Icon            =   "frmMain.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    LockControls    =   -1  'True
  11.    ScaleHeight     =   4170
  12.    ScaleWidth      =   4785
  13.    StartUpPosition =   2  'CenterScreen
  14.    Begin VB.CommandButton cmdCancel 
  15.       Caption         =   "&Cancel"
  16.       Enabled         =   0   'False
  17.       Height          =   330
  18.       Left            =   1087
  19.       TabIndex        =   7
  20.       Top             =   3405
  21.       Width           =   945
  22.    End
  23.    Begin VB.CommandButton cmdQuit 
  24.       Caption         =   "&Quit"
  25.       Height          =   330
  26.       Left            =   2115
  27.       TabIndex        =   6
  28.       Top             =   3405
  29.       Width           =   945
  30.    End
  31.    Begin VB.CommandButton cmdStart 
  32.       Caption         =   "&Start"
  33.       Height          =   330
  34.       Left            =   60
  35.       TabIndex        =   5
  36.       Top             =   3405
  37.       Width           =   945
  38.    End
  39.    Begin VB.DriveListBox Drive1 
  40.       Height          =   315
  41.       Left            =   60
  42.       TabIndex        =   0
  43.       Top             =   105
  44.       Width           =   2310
  45.    End
  46.    Begin VB.DirListBox Dir1 
  47.       Height          =   2340
  48.       Left            =   60
  49.       TabIndex        =   1
  50.       Top             =   510
  51.       Width           =   2310
  52.    End
  53.    Begin VB.FileListBox File1 
  54.       Height          =   2820
  55.       Left            =   2460
  56.       MultiSelect     =   2  'Extended
  57.       Pattern         =   "*.jp*"
  58.       TabIndex        =   2
  59.       Top             =   60
  60.       Width           =   2280
  61.    End
  62.    Begin VB.PictureBox pbProgress 
  63.       Align           =   2  'Align Bottom
  64.       FillColor       =   &H8000000D&
  65.       ForeColor       =   &H8000000D&
  66.       Height          =   300
  67.       Left            =   0
  68.       ScaleHeight     =   240
  69.       ScaleWidth      =   4725
  70.       TabIndex        =   3
  71.       TabStop         =   0   'False
  72.       Top             =   3870
  73.       Width           =   4785
  74.    End
  75.    Begin VB.Label lblMessage 
  76.       Height          =   225
  77.       Left            =   60
  78.       TabIndex        =   4
  79.       Top             =   3015
  80.       Width           =   4680
  81.    End
  82. Attribute VB_Name = "frmMain"
  83. Attribute VB_GlobalNameSpace = False
  84. Attribute VB_Creatable = False
  85. Attribute VB_PredeclaredId = True
  86. Attribute VB_Exposed = False
  87. Option Explicit
  88. Dim iResizeFlag As Integer
  89. Dim lButt As Long
  90. Dim lDir As Long
  91. Dim lFile As Long
  92. Dim lFileLeft As Long
  93. Dim lFileWidth As Long
  94. Dim lLabelWidth As Long
  95. Dim lLabelTop As Long
  96. Dim lButtonTop As Long
  97. Dim iNumSelected As Integer
  98. Dim bWorking As Boolean
  99. Private Sub cmdCancel_Click()
  100.     bCancelFlag = 1
  101. End Sub
  102. Private Sub cmdQuit_Click()
  103.     Unload Me
  104. End Sub
  105. Private Sub cmdStart_Click()
  106.     bWorking = True
  107.     Dim iCount As Integer
  108.     Dim iFiles As Integer
  109.     ChDrive Drive1.Drive
  110.     ChDir Dir1.Path
  111.     Dir1.Enabled = False
  112.     Drive1.Enabled = False
  113.     File1.Enabled = False
  114.     MousePointer = vbHourglass
  115.     cmdQuit.Enabled = False
  116.     cmdStart.Enabled = False
  117.     cmdCancel.Enabled = True
  118.     ReDim sFiles(iNumSelected)
  119.     For iCount = 0 To File1.ListCount - 1
  120.         If File1.Selected(iCount) = True Then
  121.             sFiles(iFiles) = File1.List(iCount)
  122.             iFiles = iFiles + 1
  123.         End If
  124.     Next iCount
  125.     If iFiles = 0 Then GoTo skip:
  126.     DoIt (iFiles - 1)
  127. skip:
  128.     cmdQuit.Enabled = True
  129.     cmdCancel.Enabled = False
  130.     Dir1.Enabled = True
  131.     Drive1.Enabled = True
  132.     File1.Enabled = True
  133.     MousePointer = vbDefault
  134.     bWorking = False
  135.     pbProgress.Cls
  136.     RefreshFiles
  137. End Sub
  138. Private Sub Dir1_Change()
  139.     On Error GoTo er
  140.     ChDir Dir1.Path
  141.     RefreshFiles
  142. Exit Sub
  143.     NewPath
  144. End Sub
  145. Private Sub Drive1_Change()
  146.     On Error GoTo er
  147.     ChDrive Drive1.Drive
  148.     RefreshFiles
  149. Exit Sub
  150.     NewPath
  151. End Sub
  152. Sub RefreshFiles()
  153.     Drive1.Drive = CurDir
  154.     Dir1.Path = CurDir
  155.     File1.Path = CurDir
  156.     Drive1.Refresh
  157.     Dir1.Refresh
  158.     File1.Refresh
  159.     CountSelectedFiles
  160. End Sub
  161. Private Sub File1_Click()
  162.     CountSelectedFiles
  163. End Sub
  164. Private Sub Form_Load()
  165.     iResizeFlag = 0
  166.     AdjustResize
  167.     iResizeFlag = 1
  168.     CountSelectedFiles
  169. End Sub
  170. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  171.     If bWorking = True Then
  172.         Cancel = vbCancel
  173.     End If
  174. End Sub
  175. Sub Form_Resize()
  176.     Dim lFormHeight As Long
  177.     Dim lFormWidth As Long
  178.     lFormHeight = frmMain.Height
  179.     lFormWidth = frmMain.Width
  180.     If iResizeFlag = 1 Then
  181.         If lFormHeight < 4000 Then lFormHeight = 4000
  182.         If lFormWidth < 4000 Then lFormWidth = 4000
  183.         lblMessage.Top = lFormHeight - lLabelTop
  184.         Dir1.Height = lFormHeight - lDir
  185.         File1.Height = lFormHeight - lFile
  186.         File1.Width = lFormWidth - lFileWidth
  187.         lblMessage.Width = lFormWidth - lLabelWidth
  188.         cmdStart.Top = lFormHeight - lButtonTop
  189.         cmdCancel.Top = lFormHeight - lButtonTop
  190.         cmdQuit.Top = lFormHeight - lButtonTop
  191.     End If
  192. End Sub
  193. Private Sub AdjustResize()
  194.     lButt = frmMain.Height - cmdStart.Top
  195.     lDir = frmMain.Height - Dir1.Height
  196.     lFile = frmMain.Height - File1.Height
  197.     lFileLeft = frmMain.Width - File1.Left
  198.     lFileWidth = frmMain.Width - File1.Width
  199.     lLabelWidth = frmMain.Width - lblMessage.Width
  200.     lLabelTop = frmMain.Height - lblMessage.Top
  201.     lButtonTop = frmMain.Height - cmdStart.Top
  202. End Sub
  203. Public Sub pUpdate(total As Long, progress As Long)
  204.     If progress > pbProgress.ScaleWidth Then
  205.         progress = pbProgress.ScaleWidth
  206.     End If
  207.     If total < 1 Then total = 1
  208.     pbProgress.ScaleWidth = total
  209.     pbProgress.Line (0, 0)-(progress, pbProgress.ScaleHeight), pbProgress.ForeColor, BF
  210.     DoEvents
  211. End Sub
  212. Private Sub CountSelectedFiles()
  213.     Dim iCount As Integer
  214.     Dim iSelected As Integer
  215.     For iCount = 0 To File1.ListCount - 1
  216.         If File1.Selected(iCount) = True Then
  217.             iSelected = iSelected + 1
  218.         End If
  219.     Next iCount
  220.     iNumSelected = iSelected
  221.     lblMessage.Caption = iSelected & "  selected,     " & File1.ListCount & "  total"
  222.     If iNumSelected < 1 Then
  223.         cmdStart.Enabled = False
  224.     Else
  225.         cmdStart.Enabled = True
  226.     End If
  227. End Sub
  228. Private Sub NewPath()
  229.     Drive1.Drive = App.Path
  230.     Dir1.Path = App.Path
  231.     RefreshFiles
  232. End Sub
  233.