Microsoft KB Archive/223118

= FIX: PSET Method Is Slower in Visual Basic 6.0 =

Article ID: 223118

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q223118



SYMPTOMS
A project created in Visual Basic 5.0 uses the PSet method to change the color of pixels in an object. The project is compiled into an executable file using Visual Basic 5.0. When the same project is compiled using Visual Basic 6.0, the executable file runs noticeably slower than the Visual Basic 5.0 version. The expected behavior is that the Visual Basic 6.0 application should run at least as fast as the Visual Basic 5.0 application.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



MORE INFORMATION
This section demonstrates how to create a sample project that reproduces the bug behavior. It assumes that you have Visual Basic 5.0 and 6.0 installed on the same or identical machines. It also assumes that you are familiar with the PSet Method and compiling projects. If you are not familiar with these tasks, see the REFERENCES section below for more information.

Steps to Reproduce Behavior
 Start a new Visual Basic 5.0 Standard EXE project. Form1 is created by default. Add a PictureBox, a CommandButton, and a Label control to Form1. Position the Label control so that there is ample room to its right to accommodate 40 characters.  Copy the following code to the General Declarations section of Form1: Option Explicit

Private Sub Command1_Click Dim dStart As Double Dim dEnd As Double Dim intX As Integer Dim intY As Integer Picture1.Cls dStart = Timer For intY = 1 To Picture1.ScaleHeight For intX = 1 To Picture1.ScaleWidth Picture1.PSet (intX, intY), vbBlue Next Next dEnd = Timer Label1.Caption = "Elapsed time: " & dEnd - dStart & " seconds." End Sub

Private Sub Form_Load With Picture1 .ScaleMode = 3 .TabIndex = 1 .Top = 120 .Width = 4215 End With Label1.AutoSize = True End Sub  Compile the project into an executable file. Run the executable file and click the CommandButton. Note the time shown in the Label control. Open the same project in Visual Basic 6.0. Compile the project into an executable file. Run the Visual Basic 6.0 executable file version and click the Command Button.

BUG: The Visual Basic 6.0 version is slower the Visual Basic 5.0 version.

<div class="references_section">