home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / t2win-32 / _serialz.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-08-24  |  7.8 KB  |  197 lines

  1. VERSION 4.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.    Height          =   4425
  10.    Left            =   1830
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   4020
  14.    ScaleWidth      =   8340
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   2925
  17.    Width           =   8460
  18.    Begin VB.TextBox txt_Result 
  19.       BackColor       =   &H00C0C0C0&
  20.       BorderStyle     =   0  'None
  21.       Height          =   3270
  22.       Left            =   105
  23.       Locked          =   -1  'True
  24.       MultiLine       =   -1  'True
  25.       ScrollBars      =   2  'Vertical
  26.       TabIndex        =   0
  27.       Top             =   630
  28.       Width           =   8100
  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           =   8340
  37.       _Version        =   65536
  38.       _ExtentX        =   14711
  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           =   5625
  49.       End
  50.       Begin Threed.SSCommand cmdNP 
  51.          Height          =   300
  52.          Index           =   1
  53.          Left            =   7980
  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            =   7140
  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            =   7455
  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 = "frmSerialization"
  110. Attribute VB_Creatable = False
  111. Attribute VB_Exposed = False
  112. Option Explicit
  113. Option Base 1
  114. Private Const Iteration = 250
  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 cmdNP_Click(Index As Integer)
  121.    Call sub_NextPrev(cmb_Function, Index)
  122. End Sub
  123. Private Sub cmb_Function_Click()
  124.    If (IsLoaded = False) Then Exit Sub
  125.    Call cDisableFI(mdiT2W.Picture1)
  126.    txt_Result = ""
  127.    Select Case cmb_Function.ListIndex
  128.       Case 0
  129.          Call TestSerialization
  130.    End Select
  131.    DoEvents
  132.    Call cEnableFI(mdiT2W.Picture1)
  133. End Sub
  134. Private Sub Form_Activate()
  135.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  136. End Sub
  137. Private Sub Form_Load()
  138.    IsLoaded = False
  139.    Show
  140.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_serialz.t2w")
  141.    IsLoaded = True
  142. End Sub
  143. Private Sub SSCommand1_Click()
  144.    Call cmb_Function_Click
  145. End Sub
  146. Private Sub TestSerialization()
  147.    Dim intResult        As Integer
  148.    Dim strResult        As String
  149.    Dim strDisplay       As String
  150.    Dim i                As Integer
  151.    Dim j                As Integer
  152.    Dim getSD            As tagSERIALDATA
  153.    Dim putSD            As tagSERIALDATA
  154.    Dim File1            As String
  155.    Dim File2            As String
  156.    strResult = ""
  157.    strDisplay = ""
  158.    File1 = T2WFileTest
  159.    File2 = "autoexec.serialized"
  160.    strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
  161.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  162.    putSD.Description1 = "T2WIN-32 demo"
  163.    putSD.Description2 = "Under the blue sky"
  164.    putSD.Number = 136
  165.    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
  166.    intResult = cSerialGet(File2, getSD)
  167.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  168.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  169.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  170.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  171.       
  172.    strDisplay = strDisplay & "Add 2 to serialized number part into file '" & File2 & "' is " & IIf(cSerialInc(File2, 2) = True, "OK", "KO") & vbCrLf & vbCrLf
  173.    intResult = cSerialGet(File2, getSD)
  174.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  175.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  176.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  177.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  178.    strDisplay = strDisplay & "Substract 9 to serialized number part into file '" & File2 & "' is " & IIf(cSerialInc(File2, -9) = True, "OK", "KO") & vbCrLf & vbCrLf
  179.    intResult = cSerialGet(File2, getSD)
  180.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  181.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  182.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  183.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  184.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  185.    strDisplay = strDisplay & "Remove serialization in '" & File2 & "' is " & IIf(cSerialRmv(File2) = True, "unserialized", "not unserialized") & vbCrLf & vbCrLf
  186.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  187.    txt_Result = strDisplay
  188.    'time the function
  189.    TimerHandle = cTimerOpen()
  190.    TimerStartOk = cTimerStart(TimerHandle)
  191.    For i = 1 To Iteration
  192.       intResult = cSerialGet(File2, getSD)
  193.    Next i
  194.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  195.    TimerCloseOk = cTimerClose(TimerHandle)
  196. End Sub
  197.