Microsoft KB Archive/57381

= How to Use CopyBits ToolBox Call in Macintosh QuickBASIC =

Article ID: 57381

Article Last Modified on 11/21/2006



This article was previously published under Q57381



SUMMARY
Below is an example of how to use the CopyBits ToolBox routine described on Page 508 of the &quot;Microsoft QuickBASIC for Apple Macintosh: Language Reference&quot; manual for Version 1.00.

This information applies to Microsoft QuickBASIC Version 1.00 for the Apple Macintosh.



MORE INFORMATION
The CopyBits routine description on Pages 508 and 509 is incorrect and does not work properly. In the argument list for the ToolBox trap, the following array arguments should be long integer types with the following descriptions: srcBits% > srcBits&, a pointer to the source bitmap dstBits% > dstBits&, a pointer to the destination bitmap srcRect% > srcRect&, a pointer to the source rectangle dstRect% > dstRect&, a pointer to the destination rectangle You must first invoke the trap call to get the grafPort record for the source and destination windows. The pointers to the bitmaps and rectangles are obtained from these grafPort records. CopyBits can then use this information to copy a bit image between the source and destination windows.

The program shown below uses the ToolBox trap call to get the handle to the grafPort record for the source (src) and destination (dst) grafPorts (windows). GetPort (trap number &HA874) gives the handle for the current, active window. The CopyBits ROM trap is then invoked with the ToolBox statement.

Code Example
GetPort% = &HA874 ' Trap number to grafPort record CopyBits% = &HA8EC ' Trap number for the CopyBits routine in ROM toolbox &quot;i&quot;      ' initialize the toolbox WINDOW 1,&quot;1&quot;,(310,40)-(570,250) W1GrafPort& = 0  ' initialize variable toolbox &quot;PQ&quot;, GetPort%,W1GrafPort& WINDOW 2,&quot;2&quot;,(40,40)-(300,250) W2GrafPort& = 0 toolbox &quot;PQ&quot;,GetPort%,W2GrafPort& FOR i = 1 to 150 LINE (10,i)-(150,i) NEXT i WINDOW 1 DestBitMap& = W1GrafPort& + 2 ' get bitmap from grafPort record ' of window 1 SrcBitMap& = W2GrafPort& + 2  ' get bitmap from grafPort Record ' of window 2. This is where we'll                              ' draw our graphics. SrcRect& = W1GrafPort& + 16   ' get rectangle from grafPort record ' of window 1 DestRect& = SrcRect&          ' Get rectangle for destination bitmap hMaskRgn& = PEEKL(W2GrafPort& + 28) TxMode% = 0                   ' Only copy the source grafPort ' The following two lines must be placed on one physical line: toolbox &quot;PQ&quot;,CopyBits%,(SrcBitMap&),(DestBitMap&),(SrcRect&), (DestRect&),(TxMode%),(hMaskRgn&) 'Append this to previous line WINDOW CLOSE 1 WINDOW CLOSE 2 END

Additional query words: MQuickB

Keywords: KB57381

-

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

© Microsoft Corporation. All rights reserved.