Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Public Function FormTestSpeed(frm As Form) As Long
Dim lSpeedTime As Long
Dim SInfoSpeed As String
lSpeedTime = GetTickCount
Unload frm
Load frm
frm.Show
lSpeedTime = GetTickCount - lSpeedTime
' this is only simulation
If lSpeedTime <= 50 Then
SInfoSpeed = "[Very Fast]"
ElseIf lSpeedTime >= 50 And lSpeedTime <= 100 Then
SInfoSpeed = "[Normal]"
ElseIf lSpeedTime >= 100 And lSpeedTime <= 200 Then
SInfoSpeed = "[Slow]"
ElseIf lSpeedTime >= 200 Then
SInfoSpeed = "[Very Slow]"
End If
frm.Caption = "Time Speed Form: " & lSpeedTime & " Milliseconds - " & SInfoSpeed
End Function
Contoh penggunaan fungsi di atas:
Private Sub Command1_Click()
FormTestSpeed Form2
End Sub