Microsoft KB Archive/95482

= QuickBasic for Macintosh: Drawing a PICT File Larger Than 32K =

Article ID: 95482

Article Last Modified on 1/8/2003

-

APPLIES TO


 * Microsoft QuickBasic Compiler for Macintosh 1.0

-



This article was previously published under Q95482



SUMMARY
When the PICTURE statement is used to draw PICT files, the PICT file is put in a string variable to be displayed. However, strings have a maximum size of 32,767 characters; therefore, a picture file larger than this cannot be displayed with PICTURE.



MORE INFORMATION
To work around this limitation, the picture must be put into a resource file and drawn with calls to the Toolbox Library. To do this, follow the steps below using ResEdit 2.1. Different versions of ResEdit may require modifications to the steps below.

 Start the drawing application that created the picture file, and load the picture. Select the picture and copy it to the Clipboard. Quit the drawing application and start ResEdit. From the File menu, choose New and give the new file a name. This will be the resource file that holds the picture. From the Resource menu, choose Create New Resource. For the type of resource, enter PICT. Make sure the letters are capitalized, then choose the OK button. From the Edit menu, choose Paste. This will paste the entire picture into the PICT resource.</li> Make a note of the PICT ID number for this picture. It is at the bottom of the Picture window, and you will need it to pull the picture into QuickBasic. This number can be changed by choosing Get Resource Info from the Resource menu, if desired.</li> From the File menu, choose Save menu to save the resource file.</li>  Use the following code to pull the resource PICT file into QuickBasic: ' This code will read picture ID 128 from a resource file ' created with ResEdit.

SUB drawpict (pictid%,pictfile$) ' pictid% is the picture ID in the resource file from step 8 ' above. pictfile$ is the name of the picture file from step 4 ' above.

ref% = 0             ' This must be initialized to zero or                               ' you will get an error message. handle&amp; = 0          ' This also must be initialized to                               ' zero.

OpenResFile pict$,ref%' This opens the resource file that ' you created with ResEdit. GetPicture ref%,pictid%,handle& ' This returns a handle to                                        ' the picture resource so                                         ' we can use it. DrawPicture handle&  ' This will draw it. See manual for ' changing draw location. END SUB </li></ol>

For more information, see these publications:


 * &quot;Inside Macintosh Volume V,&quot; &quot;Picture Compatibility,&quot; page V-92, by Apple Computer, Inc.
 * &quot;Microsoft QuickBasic: Language Reference,&quot; Appendix E, GetPicture, DrawPicture, and other Toolbox routines

Also query on the following words in the Microsoft Knowledge Base:

making and bitmap and resource and openpicture and addpicture

making and pict and resource and picture$ and savepicture

Additional query words: MQuickB 1.00

Keywords: KB95482

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.