Microsoft KB Archive/36349: Difference between revisions
m (Text replacement - ">" to ">") |
m (Text replacement - "&" to "&") |
||
Line 59: | Line 59: | ||
The following is a code example: | The following is a code example: | ||
<pre class="codesample">PICTURE ON ' Turn on recording of the picture in heap space. | <pre class="codesample">PICTURE ON ' Turn on recording of the picture in heap space. | ||
size& | size& = 0 | ||
WHILE size& | WHILE size& < 32700 'leave some margin | ||
PSET(RND*400+100,RND*400+100) ' Draw a pixel at a random location. | PSET(RND*400+100,RND*400+100) ' Draw a pixel at a random location. | ||
GetPictureSize size& | GetPictureSize size& ' SUBprogram returns current picture size. | ||
WEND | WEND | ||
PICTURE OFF ' Turn off recording of the picture in heap space. | PICTURE OFF ' Turn off recording of the picture in heap space. | ||
Line 70: | Line 70: | ||
END | END | ||
' This SUBprogram returns the size of the picture currently recording: | ' This SUBprogram returns the size of the picture currently recording: | ||
SUB GetPictureSize( Size& | SUB GetPictureSize( Size& ) STATIC | ||
hPic& | hPic& = PEEKL( PEEKL(PEEKL(PEEKL(&H904))) + &H5C ) | ||
IF hPic& | IF hPic& <> 0 THEN 'return size of picture | ||
size& | size& = PEEKW(PEEKL(PEEKL(PEEKL(hPic&)))) | ||
ELSE 'no picture being recorded | ELSE 'no picture being recorded | ||
size& | size& = 0 | ||
END IF | END IF | ||
END SUB | END SUB |
Latest revision as of 14:14, 21 July 2020
Article ID: 36349
Article Last Modified on 1/8/2003
APPLIES TO
- Microsoft QuickBasic Compiler for Macintosh 1.0
This article was previously published under Q36349
SUMMARY
This article applies to Macintosh QuickBASIC Version 1.00 for the Apple Macintosh.
When collecting a large picture with the PICTURE ON...PICTURE OFF statements, the size of the picture may grow beyond the 32K maximum size allowed for a string variable. When the picture is assigned to a string variable with p$ = PICTURE$, a "String too long", error 15 message will appear if the recorded picture has exceeded 32,767 bytes.
The subprogram below allows you to monitor the current size of the picture that is being recorded. This allows you to stop recording and start a new picture when the size of the current picture approaches the limit for a BASIC string.
MORE INFORMATION
In the 64K ROM Macintoshes, QuickDraw pictures were limited to 32,767 bytes, but in the newer, 128K ROM (enhanced) Macintoshes, they are no longer restricted in size.
The following is a code example:
PICTURE ON ' Turn on recording of the picture in heap space. size& = 0 WHILE size& < 32700 'leave some margin PSET(RND*400+100,RND*400+100) ' Draw a pixel at a random location. GetPictureSize size& ' SUBprogram returns current picture size. WEND PICTURE OFF ' Turn off recording of the picture in heap space. p$ = PICTURE$ 'get picture into a BASIC string PICTURE ,p$ 'draw the recorded picture WHILE MOUSE(0) <> 1 : WEND 'wait for mouse click END ' This SUBprogram returns the size of the picture currently recording: SUB GetPictureSize( Size& ) STATIC hPic& = PEEKL( PEEKL(PEEKL(PEEKL(&H904))) + &H5C ) IF hPic& <> 0 THEN 'return size of picture size& = PEEKW(PEEKL(PEEKL(PEEKL(hPic&)))) ELSE 'no picture being recorded size& = 0 END IF END SUB
Additional query words: MQuickB
Keywords: KB36349