home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Power Pack / Visual_Basic4_Power_Pack.bin / vb4files / t2win_32 / _compres.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-11-20  |  7.5 KB  |  209 lines

  1. VERSION 4.00
  2. Begin VB.Form frmCompress 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Compress - Expand"
  5.    ClientHeight    =   4845
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   7485
  9.    Height          =   5250
  10.    Left            =   1830
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   4845
  14.    ScaleWidth      =   7485
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   2925
  17.    Width           =   7605
  18.    Begin VB.TextBox txt_Result 
  19.       BackColor       =   &H00C0C0C0&
  20.       BorderStyle     =   0  'None
  21.       Height          =   4110
  22.       Left            =   105
  23.       Locked          =   -1  'True
  24.       MultiLine       =   -1  'True
  25.       ScrollBars      =   2  'Vertical
  26.       TabIndex        =   0
  27.       Top             =   630
  28.       Width           =   7260
  29.    End
  30.    Begin Threed.SSPanel SSPanel1 
  31.       Align           =   1  'Align Top
  32.       Height          =   480
  33.       Left            =   0
  34.       TabIndex        =   1
  35.       Top             =   0
  36.       Width           =   7485
  37.       _Version        =   65536
  38.       _ExtentX        =   13203
  39.       _ExtentY        =   847
  40.       _StockProps     =   15
  41.       ForeColor       =   -2147483640
  42.       BackColor       =   12632256
  43.       Begin VB.ComboBox cmb_Function 
  44.          Height          =   315
  45.          Left            =   1365
  46.          TabIndex        =   2
  47.          Top             =   90
  48.          Width           =   4785
  49.       End
  50.       Begin Threed.SSCommand cmdNP 
  51.          Height          =   300
  52.          Index           =   1
  53.          Left            =   7140
  54.          TabIndex        =   6
  55.          Top             =   90
  56.          Width           =   255
  57.          _Version        =   65536
  58.          _ExtentX        =   450
  59.          _ExtentY        =   529
  60.          _StockProps     =   78
  61.          Caption         =   ">"
  62.          BevelWidth      =   1
  63.          Font3D          =   3
  64.          RoundedCorners  =   0   'False
  65.          Outline         =   0   'False
  66.       End
  67.       Begin Threed.SSCommand cmdNP 
  68.          Height          =   300
  69.          Index           =   0
  70.          Left            =   6300
  71.          TabIndex        =   5
  72.          Top             =   90
  73.          Width           =   255
  74.          _Version        =   65536
  75.          _ExtentX        =   450
  76.          _ExtentY        =   529
  77.          _StockProps     =   78
  78.          Caption         =   "<"
  79.          BevelWidth      =   1
  80.          Font3D          =   3
  81.          RoundedCorners  =   0   'False
  82.          Outline         =   0   'False
  83.       End
  84.       Begin VB.Label Label2 
  85.          Caption         =   "&Select a function"
  86.          Height          =   255
  87.          Left            =   90
  88.          TabIndex        =   4
  89.          Top             =   120
  90.          Width           =   1275
  91.       End
  92.       Begin Threed.SSCommand SSCommand1 
  93.          Default         =   -1  'True
  94.          Height          =   300
  95.          Left            =   6615
  96.          TabIndex        =   3
  97.          Top             =   90
  98.          Width           =   465
  99.          _Version        =   65536
  100.          _ExtentX        =   820
  101.          _ExtentY        =   529
  102.          _StockProps     =   78
  103.          Caption         =   "&Go"
  104.          BevelWidth      =   1
  105.          RoundedCorners  =   0   'False
  106.          Outline         =   0   'False
  107.       End
  108.    End
  109. Attribute VB_Name = "frmCompress"
  110. Attribute VB_Creatable = False
  111. Attribute VB_Exposed = False
  112. Option Explicit
  113. Option Base 1
  114. Private Const Iteration = 10
  115. Dim IsLoaded         As Integer
  116. Dim TimerStartOk     As Integer
  117. Dim TimerCloseOk     As Integer
  118. Dim TimerHandle      As Integer
  119. Dim TimerValue       As Long
  120. Private Sub cmb_Function_Click()
  121.    If (IsLoaded = False) Then Exit Sub
  122.    Call cDisableFI(mdiT2W.Picture1)
  123.    txt_Result = ""
  124.    DoEvents
  125.    Select Case cmb_Function.ListIndex
  126.       Case 0
  127.          Call TestFileCompress
  128.       Case 1
  129.          Call TestStringCompress
  130.    End Select
  131.    DoEvents
  132.    Call cEnableFI(mdiT2W.Picture1)
  133. End Sub
  134. Private Sub cmdNP_Click(Index As Integer)
  135.    Call sub_NextPrev(cmb_Function, Index)
  136. End Sub
  137. Private Sub Form_Activate()
  138.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  139. End Sub
  140. Private Sub Form_Load()
  141.    IsLoaded = False
  142.    Show
  143.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_compres.t2w")
  144.    IsLoaded = True
  145. End Sub
  146. Private Sub SSCommand1_Click()
  147.    Call cmb_Function_Click
  148. End Sub
  149. Private Sub TestFileCompress()
  150.    Dim lngResult        As Long
  151.    Dim strResult        As String
  152.    Dim strDisplay       As String
  153.    Dim i                As Integer
  154.    Dim File1            As String
  155.    Dim File2            As String
  156.    Dim File3            As String
  157.    strResult = ""
  158.    strDisplay = ""
  159.    File1 = T2WFileTest
  160.    File2 = "autoexec.compressed"
  161.    File3 = "autoexec.expanded"
  162.    strDisplay = strDisplay & "File Compress '" & File1 & "' to '" & File2 & "' is " & cFileCompress(File1, File2) & vbCrLf
  163.    strDisplay = strDisplay & "File Expand '" & File2 & "' to '" & File3 & "' is " & cFileExpand(File2, File3) & vbCrLf
  164.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  165.    txt_Result = strDisplay
  166.    'time the function
  167.    TimerHandle = cTimerOpen()
  168.    TimerStartOk = cTimerStart(TimerHandle)
  169.    For i = 1 To Iteration
  170.       lngResult = cFileCompress(File1, File2)
  171.    Next i
  172.    lngResult = cFileExpand(File2, File3)
  173.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  174.    TimerCloseOk = cTimerClose(TimerHandle)
  175. End Sub
  176. Public Sub TestStringCompress()
  177.    Dim lngResult        As Long
  178.    Dim strResult        As String
  179.    Dim strDisplay       As String
  180.    Dim i                As Integer
  181.    Dim Str1             As String
  182.    Dim Str2             As String
  183.    Dim Str3             As String
  184.    strResult = ""
  185.    strDisplay = ""
  186.    Str1 = "T2WIN-32, t2win-32, T2WIN-32, t2win-32, T2WIN-32, t2win-32"
  187.    Str2 = cStringCompress(Str1)
  188.    Str3 = cStringExpand(Str2)
  189.    strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
  190.    strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
  191.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  192.    Str1 = String$(30, "a") + String$(6, "b") + String$(5, "c") + String$(4, "d")
  193.    Str2 = cStringCompress(Str1)
  194.    Str3 = cStringExpand(Str2)
  195.    strDisplay = strDisplay & "String Compress '" & Str1 & "' is " & Format$(Len(Str1)) & " to " & Format$(Len(Str2)) & " bytes." & vbCrLf
  196.    strDisplay = strDisplay & "String Expand is '" & Str3 & "'" & vbCrLf
  197.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  198.    txt_Result = strDisplay
  199.    'time the function
  200.    TimerHandle = cTimerOpen()
  201.    TimerStartOk = cTimerStart(TimerHandle)
  202.    For i = 1 To Iteration
  203.       Str2 = cStringCompress(Str1)
  204.    Next i
  205.    Str3 = cStringExpand(Str2)
  206.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  207.    TimerCloseOk = cTimerClose(TimerHandle)
  208. End Sub
  209.