home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmAPICheck
- Caption = "API Calling Test"
- ClientHeight = 2790
- ClientLeft = 1140
- ClientTop = 1485
- ClientWidth = 4440
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 2790
- ScaleWidth = 4440
- Begin VB.CommandButton cmdCallDLL2
- Caption = "Call In DLL Server 2"
- Height = 555
- Left = 180
- TabIndex = 5
- Top = 2040
- Width = 1755
- End
- Begin VB.CommandButton cmdCallDLL
- Caption = "Call In DLL Server"
- Height = 555
- Left = 180
- TabIndex = 4
- Top = 1440
- Width = 1755
- End
- Begin VB.CommandButton cmdInFunction
- Caption = "Call In Function"
- Height = 555
- Left = 180
- TabIndex = 3
- Top = 840
- Width = 1755
- End
- Begin VB.CommandButton cmdDirect
- Caption = "Call Directly"
- Height = 555
- Left = 180
- TabIndex = 0
- Top = 240
- Width = 1755
- End
- Begin VB.Label lblKernel
- Height = 255
- Left = 2220
- TabIndex = 6
- Top = 660
- Width = 2115
- End
- Begin VB.Label lblTicks
- Height = 255
- Left = 2220
- TabIndex = 2
- Top = 1020
- Width = 2115
- End
- Begin VB.Label lblUser
- Height = 255
- Left = 2220
- TabIndex = 1
- Top = 300
- Width = 2115
- End
- Attribute VB_Name = "frmAPICheck"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- ' Copyright
- 1997 by Desaware Inc. All Rights Reserved
- Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
- Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
- Dim r As New dwBenchMark
- Private Sub cmdCallDLL_Click()
- Dim marker As New dwBenchMark
- Dim wintext As Object
- Dim res$
- Dim counter&
- Dim usewnd&
- usewnd = hwnd
- Set wintext = CreateObject("tstWindowText.App")
- Screen.MousePointer = vbHourglass
- marker.SetReference
- For counter = 1 To 10000
- res$ = wintext.GetWindowText(usewnd)
- Next counter
- marker.SetMark
- Screen.MousePointer = vbDefault
- ShowDifference marker
- End Sub
- Private Sub cmdCallDLL2_Click()
- Dim marker As New dwBenchMark
- Dim wintext As tstWindowText.App
- Dim res$
- Dim counter&
- Dim usewnd&
- usewnd = hwnd
- Set wintext = CreateObject("tstWindowText.App")
- Screen.MousePointer = vbHourglass
- marker.SetReference
- With wintext
- For counter = 1 To 10000
- res$ = .GetWindowText(usewnd)
- Next counter
- End With
- marker.SetMark
- Screen.MousePointer = vbDefault
- ShowDifference marker
- End Sub
- Private Sub cmdDirect_Click()
- Dim textlen As Long
- Dim usewnd As Long
- Dim counter As Long
- Dim marker As New dwBenchMark
- Dim res$
- usewnd = hwnd
- textlen = GetWindowTextLength(usewnd) + 1
- res$ = String$(textlen + 1, 0)
- Screen.MousePointer = vbHourglass
- marker.SetReference
- For counter = 1 To 10000
- Call GetWindowText(usewnd, res$, textlen)
- Next counter
- marker.SetMark
- Screen.MousePointer = vbDefault
- ShowDifference marker
- End Sub
- Public Sub ShowDifference(marker As Object)
- lblTicks.Caption = "Ticks = " & marker.GetTickDifference() & " ms"
- lblUser.Caption = "User time = " & marker.GetuserDifferenceMS() & " ms"
- lblKernel.Caption = "Kernel time = " & marker.GetkernelDifferenceMS() & " ms"
- End Sub
- Public Function InternalGetWindowText(ByVal usewnd As Long) As String
- Dim textlen As Long
- Dim res$
- textlen = GetWindowTextLength(usewnd) + 1
- res$ = String$(textlen + 1, 0)
- Call GetWindowText(usewnd, res$, textlen)
- InternalGetWindowText = res$
- End Function
- Private Sub cmdInFunction_Click()
- Dim marker As New dwBenchMark
- Dim res$
- Dim counter&
- Dim usewnd&
- usewnd = hwnd
- Screen.MousePointer = vbHourglass
- marker.SetReference
- For counter = 1 To 10000
- res$ = InternalGetWindowText(usewnd)
- Next counter
- marker.SetMark
- Screen.MousePointer = vbDefault
- ShowDifference marker
- End Sub
-