home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 35 / hot35.iso / ficheros / LVB / T2W32543.ZIP / _SERIALZ.FRM < prev    next >
Text File  |  1998-05-21  |  7KB  |  218 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSerialization 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Serialization"
  5.    ClientHeight    =   4020
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   8340
  9.    MaxButton       =   0   'False
  10.    MDIChild        =   -1  'True
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   4020
  13.    ScaleWidth      =   8340
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.Frame Frame1 
  16.       Height          =   570
  17.       Left            =   0
  18.       TabIndex        =   1
  19.       Top             =   -90
  20.       Width           =   8310
  21.       Begin VB.CommandButton cmdNP 
  22.          Caption         =   ">"
  23.          Height          =   285
  24.          Index           =   1
  25.          Left            =   7920
  26.          TabIndex        =   6
  27.          Top             =   195
  28.          Width           =   285
  29.       End
  30.       Begin VB.CommandButton cmdNP 
  31.          Caption         =   "<"
  32.          Height          =   285
  33.          Index           =   0
  34.          Left            =   7020
  35.          TabIndex        =   5
  36.          Top             =   195
  37.          Width           =   285
  38.       End
  39.       Begin VB.CommandButton Command1 
  40.          Caption         =   "&Go"
  41.          Default         =   -1  'True
  42.          Height          =   285
  43.          Left            =   7380
  44.          TabIndex        =   4
  45.          Top             =   195
  46.          Width           =   465
  47.       End
  48.       Begin VB.ComboBox cmb_Function 
  49.          Height          =   315
  50.          Left            =   1365
  51.          TabIndex        =   2
  52.          Top             =   180
  53.          Width           =   5565
  54.       End
  55.       Begin VB.Label Label2 
  56.          Caption         =   "&Select a function"
  57.          Height          =   255
  58.          Left            =   90
  59.          TabIndex        =   3
  60.          Top             =   210
  61.          Width           =   1275
  62.       End
  63.    End
  64.    Begin VB.TextBox txt_Result 
  65.       BackColor       =   &H00C0C0C0&
  66.       BorderStyle     =   0  'None
  67.       Height          =   3270
  68.       Left            =   105
  69.       Locked          =   -1  'True
  70.       MultiLine       =   -1  'True
  71.       ScrollBars      =   2  'Vertical
  72.       TabIndex        =   0
  73.       Top             =   630
  74.       Width           =   8100
  75.    End
  76. End
  77. Attribute VB_Name = "frmSerialization"
  78. Attribute VB_GlobalNameSpace = False
  79. Attribute VB_Creatable = False
  80. Attribute VB_PredeclaredId = True
  81. Attribute VB_Exposed = False
  82. Option Explicit
  83. Option Base 1
  84.  
  85. Private Const Iteration = 250
  86.  
  87. Dim IsLoaded         As Integer
  88.  
  89. Dim TimerStartOk     As Integer
  90. Dim TimerCloseOk     As Integer
  91.  
  92. Dim TimerHandle      As Integer
  93. Dim TimerValue       As Long
  94.  
  95. Private Sub cmdNP_Click(Index As Integer)
  96.  
  97.    Call sub_NextPrev(cmb_Function, Index)
  98.  
  99. End Sub
  100.  
  101. Private Sub cmb_Function_Click()
  102.    
  103.    If (IsLoaded = False) Then Exit Sub
  104.    
  105.    Call cDisableFI(mdiT2W.Picture1)
  106.    
  107.    txt_Result = ""
  108.    
  109.    Select Case cmb_Function.ListIndex
  110.       Case 0
  111.          Call TestSerialization
  112.    End Select
  113.  
  114.    DoEvents
  115.    Call cEnableFI(mdiT2W.Picture1)
  116.    
  117. End Sub
  118.  
  119.  
  120. Private Sub Form_Activate()
  121.  
  122.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  123.  
  124. End Sub
  125.  
  126. Private Sub Form_Load()
  127.  
  128.    IsLoaded = False
  129.    
  130.    Show
  131.  
  132.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_serialz.t2w")
  133.    
  134.    IsLoaded = True
  135.    
  136. End Sub
  137.  
  138. Private Sub Command1_Click()
  139.    
  140.    Call cmb_Function_Click
  141.    
  142. End Sub
  143.  
  144. Private Sub TestSerialization()
  145.  
  146.    Dim intResult        As Integer
  147.    Dim strResult        As String
  148.    Dim strDisplay       As String
  149.    
  150.    Dim i                As Integer
  151.    Dim j                As Integer
  152.    
  153.    Dim getSD            As tagSERIALDATA
  154.    Dim putSD            As tagSERIALDATA
  155.    
  156.    Dim File1            As String
  157.    Dim File2            As String
  158.  
  159.    strResult = ""
  160.    strDisplay = ""
  161.    
  162.    File1 = T2WFileTest
  163.    File2 = "autoexec.serialized"
  164.    
  165.    strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
  166.    
  167.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  168.  
  169.    putSD.Description1 = "T2WIN-32 demo"
  170.    putSD.Description2 = "Under the blue sky"
  171.    putSD.Number = 136
  172.    strDisplay = strDisplay & "Put/Modify '" & Trim$(putSD.Description1) & "' - '" & Trim$(putSD.Description2) & "' - '" & putSD.Number & "' into file '" & File2 & "' is " & IIf(cSerialPut(File2, putSD) = True, "OK", "KO") & vbCrLf & vbCrLf
  173.    
  174.    intResult = cSerialGet(File2, getSD)
  175.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  176.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  177.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  178.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  179.       
  180.    strDisplay = strDisplay & "Add 2 to serialized number part into file '" & File2 & "' is " & IIf(cSerialInc(File2, 2) = True, "OK", "KO") & vbCrLf & vbCrLf
  181.    intResult = cSerialGet(File2, getSD)
  182.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  183.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  184.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  185.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  186.  
  187.    strDisplay = strDisplay & "Substract 9 to serialized number part into file '" & File2 & "' is " & IIf(cSerialInc(File2, -9) = True, "OK", "KO") & vbCrLf & vbCrLf
  188.    intResult = cSerialGet(File2, getSD)
  189.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  190.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  191.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  192.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  193.  
  194.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  195.  
  196.    strDisplay = strDisplay & "Remove serialization in '" & File2 & "' is " & IIf(cSerialRmv(File2) = True, "unserialized", "not unserialized") & vbCrLf & vbCrLf
  197.  
  198.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  199.  
  200.    txt_Result = strDisplay
  201.    
  202.    'time the function
  203.  
  204.    TimerHandle = cTimerOpen()
  205.    TimerStartOk = cTimerStart(TimerHandle)
  206.    
  207.    For i = 1 To Iteration
  208.       intResult = cSerialGet(File2, getSD)
  209.    Next i
  210.    
  211.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  212.    
  213.    TimerCloseOk = cTimerClose(TimerHandle)
  214.  
  215. End Sub
  216.  
  217.  
  218.