home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / articles / vbdev / source / pin14vb4.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-21  |  3.1 KB  |  118 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Some simple benchmarks"
  4.    ClientHeight    =   3075
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1515
  7.    ClientWidth     =   3795
  8.    Height          =   3480
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3075
  12.    ScaleWidth      =   3795
  13.    Top             =   1170
  14.    Width           =   3915
  15.    Begin VB.CommandButton Command5 
  16.       Caption         =   "Form Loader"
  17.       Height          =   375
  18.       Left            =   1020
  19.       TabIndex        =   4
  20.       Top             =   2160
  21.       Width           =   1635
  22.    End
  23.    Begin VB.CommandButton Command4 
  24.       Caption         =   "Read Caption"
  25.       Height          =   375
  26.       Left            =   1020
  27.       TabIndex        =   3
  28.       Top             =   1740
  29.       Width           =   1635
  30.    End
  31.    Begin VB.CommandButton Command3 
  32.       Caption         =   "Build string"
  33.       Height          =   375
  34.       Left            =   1020
  35.       TabIndex        =   2
  36.       Top             =   1320
  37.       Width           =   1635
  38.    End
  39.    Begin VB.CommandButton Command2 
  40.       Caption         =   "Double loop"
  41.       Height          =   375
  42.       Left            =   1020
  43.       TabIndex        =   1
  44.       Top             =   900
  45.       Width           =   1635
  46.    End
  47.    Begin VB.CommandButton Command1 
  48.       Caption         =   "Long loop"
  49.       Height          =   375
  50.       Left            =   1020
  51.       TabIndex        =   0
  52.       Top             =   480
  53.       Width           =   1635
  54.    End
  55. Attribute VB_Name = "Form1"
  56. Attribute VB_Creatable = False
  57. Attribute VB_Exposed = False
  58. Option Explicit
  59. #If Win32 Then
  60. Private Declare Function GetTickCount Lib "kernel32" () As Long
  61. #Else
  62. Private Declare Function GetTickCount Lib "user" () As Long
  63. #End If
  64. Private Sub Command1_Click()
  65.     Dim dl&
  66.     Dim ctr&
  67.     dl& = GetTickCount()
  68.     For ctr& = 1 To 10000000
  69.     Next ctr&
  70.     DoEvents
  71.     MsgBox "Time: " & GetTickCount() - dl& & " ms"
  72. End Sub
  73. Private Sub Command2_Click()
  74.     Dim dl&
  75.     Dim ctr#
  76.     dl& = GetTickCount()
  77.     For ctr# = 1 To 600000 Step 0.1
  78.     Next ctr#
  79.     DoEvents
  80.     MsgBox "Time: " & GetTickCount() - dl& & " ms"
  81. End Sub
  82. Private Sub Command3_Click()
  83.     Dim dl&
  84.     Dim ctr&
  85.     Dim s$
  86.     dl& = GetTickCount()
  87.     For ctr& = 1 To 20000
  88.             s$ = s$ & "x"
  89.     Next ctr&
  90.     DoEvents
  91.     MsgBox "Time: " & GetTickCount() - dl& & " ms"
  92. End Sub
  93. Private Sub Command4_Click()
  94.     Dim dl&
  95.     Dim ctr&
  96.     Dim s$
  97.     dl& = GetTickCount()
  98.     For ctr& = 1 To 40000
  99.         s$ = Command4.Caption
  100.     Next ctr&
  101.     DoEvents
  102.     MsgBox "Time: " & GetTickCount() - dl& & " ms"
  103. End Sub
  104. Private Sub Command5_Click()
  105.     Dim dl&
  106.     Dim ctr&
  107.     dl& = GetTickCount()
  108.     For ctr& = 1 To 100
  109.         Form2.Show
  110.         Form2.Refresh
  111.         Unload Form2
  112.     Next ctr&
  113.     DoEvents
  114.     MsgBox "Time: " & GetTickCount() - dl& & " ms"
  115. End Sub
  116. Private Sub Form_Load()
  117. End Sub
  118.