Microsoft KB Archive/78387

= BUG: GetPicture &quot;Invalid Function Call&quot; after CHAIN =

Article ID: 78387

Article Last Modified on 10/23/2003

-

APPLIES TO


 * Microsoft QuickBasic Compiler for Macintosh 1.0
 * Microsoft QuickBasic Compiler for Macintosh 1.0
 * Microsoft QuickBasic Compiler for Macintosh 1.0

-



This article was previously published under Q78387



SYMPTOMS
Attempting to CHAIN to a program that uses the GetPicture toolbox routine (an MBLC stored in QuickBasic for Macintosh) will result in an &quot;Invalid function call&quot; (error 5) under the following conditions:


 * The program is run in the QuickBasic interpreter.
 * The program being chained from does not contain the PICT resource needed by GetPicture.

This problem occurs because the program being chained to attempts to use the resource fork of the original program (the program chained from) that was run. If the resource fork of the original program does not contain a PICT resource, then a call to the GetPicture toolbox routine will fail with an &quot;Invalid function call&quot; error.

This problem does not occur in a compiled program. In a compiled program, the resource fork of the program being chained from is closed and the resource fork of the program being chained to is used.



Steps to Reproduce Problem
 Launch QuickBasic  From the code window of the QuickBasic development environment, enter the following code. CHAIN &quot;ToolBoxSampler&quot;  From the File menu, choose Save. In the &quot;Save program as:&quot; dialog box, type chainer and press ENTER. From the Run menu, choose Run Program. If the &quot;Can't fine&quot; ToolBoxSampler&quot; dialog box appears, choose OK. Otherwise, go to step 9 below. Find ToolBoxSampler in the appropriate folder. ToolBoxSampler is a demonstration program supplied with Microsoft QuickBasic version 1.0. It is located in the QB Demos folder of the Examples disk.</li> Highlight ToolBoxSampler and choose Open.</li> From the dialog box introducing the ToolBoxSampler, choose OK. The error message &quot;Invalid function call&quot; will occur on the statement GetPicture ref%, 20, d!.</li></ol>

<div class="workaround_section">

WORKAROUND
You can work around the problem by copying the PICT resource (needed by GetPicture) to the chained-from program, as follows:


 * 1) Launch ResEdit.
 * 2) From the files/folders list box, click on the folder containing ToolBoxSampler. Repeat this step as many times as necessary until the ToolBoxSampler is found.
 * 3) From the files/folders list box, select ToolBoxSampler. A list box containing the resources associated with ToolBoxSampler will appear.
 * 4) From the resource list box, click on PICT.
 * 5) From the Edit menu, choose Copy.
 * 6) Close the resource list box.
 * 7) From the file/folders list boxes remaining on the screen, close as many of the list boxes as necessary such that the program &quot;chainer&quot; created in step 4 above can be found.
 * 8) Click on chainer. A list box containing the resources associated with the program chainer will appear.
 * 9) From the Edit menu, choose Paste. PICT will be added to the list of resources.
 * 10) From the File menu, choose Quit.
 * 11) From the &quot;Save 'chainer' before closing?&quot; dialog box, select Yes.
 * 12) Follow steps 1 through 9 further above.

After being chained to, the ToolBoxSampler should run without error.

Additional query words: MQuickB 1.00 1.00a 1.00b

Keywords: kbbug KB78387

-

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

© Microsoft Corporation. All rights reserved.