DOCUMENT:Q174825 08-OCT-1997 [vbwin] TITLE :BUG: Accessing Image Property of PictureBox Diminishes Resources PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0 OPER/SYS:Win95 WINDOWS KEYWORDS:vb5all VBKBCtrl VBKBInt VBKBStd ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 5.0 on the following platform: Win95 --------------------------------------------------------------------- SYMPTOMS ======== Using the Image property of a PictureBox control repeatedly diminishes GDI and System resources on Windows 95. RESOLUTION ========== Use the BitBlt API function to provide the same functionality as the Image property. The following article in the Microsoft Knowledge Base provides information about using the BitBlt API function: ARTICLE-ID: Q147810 TITLE : HOWTO: Use Windows BitBlt Function in Visual Basic Application STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ The following shows you how to create a sample project that demonstrates this bug. The instructions assume that you have the System Resource Meter running so you can see the effect of accessing the Image property. The System Resource Meter is a system tool usually installed in the Accessories program group if you select the System Resource Meter option when you install Windows 95. Steps to Reproduce Behavior --------------------------- 1. Start a new Standard EXE project in Visual Basic. Form1 is created by default. 2. Add a PictureBox, Command Button, and Label control to Form1. 3. Set the Picture property of the PictureBox control to an appropriate bitmap file. 4. Copy the following code to the Code window of Form1: Option Explicit Private Sub Command1_Click() Dim I as Integer For I = 1 to 100 Picture1.Picture = Picture1.Image Label1.Caption = Trim(Str(I)) DoEvents Next I End Sub 4. Press the F5 key to run the program. Minimize the Visual Basic IDE so you can see both Form1 and the System Resource meter running. Click Command1 and note how the GDI and System Resources diminish by about 20 percent with the click of the CommandButton. ====================================================================== Keywords : vb5all VBKBCtrl VBKBInt VBKBStd Version : WINDOWS:5.0 Platform : Win95 WINDOWS Issue type : kbbug ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1997.