Microsoft KB Archive/47970

= Common MBLC Toolbox Programming Errors in Macintosh QuickBASIC =

Article ID: 47970

Article Last Modified on 11/21/2006



This article was previously published under Q47970



SUMMARY
The following are the most prevalent error messages received when programming with MBLC Toolbox Library routines in Microsoft QuickBASIC Version 1.00 for the Apple Macintosh:


 * 1) &quot;Invalid Function Call&quot; (Error 5)
 * 2) &quot;Type Mismatch&quot; (Error 13)
 * 3) &quot;Undefined Subprogram&quot; (Error 35)

Common programming mistakes that cause these errors are described further below. This information is taken from Page 524 of the &quot;Microsoft QuickBASIC for Apple Macintosh: Language Reference&quot; manual.



MORE INFORMATION
  &quot;Invalid Function Call&quot; (Error 5) This error can occur when you try to retrieve a nonexistent resource from a resource file. ' ************************************************************  ' Run the following program and an Invalid Function Call error ' should be generated because there is no resource &quot;12345&quot;. ' ************************************************************  Type$ = &quot;12345&quot; Num% = 0 CountRes Type$, Num% PRINT Num% END   &quot;Type Mismatch&quot; (Error 13)

This error can occur under any of the following conditions:

 You invoke an MBLC library statement and pass a variable that hasn't been previously defined (initialized). Not enough variables follow the routine name. A library statement name is incorrectly declared as a string with a DEFSTR statement. A passed parameter is of the wrong type.</ol>

You must initialize all parameters in the library routine, whether values are passed or returned. Initializing the variables means giving them a value, whether it be 0 (zero) for numbers or a null string (&quot;&quot;) for string variables. ' ************************************************************  ' This program gives a Type Mismatch error because the ' Num% is not initialized to 0 before making the call. ' ************************************************************  Type$ = &quot;ICON&quot; ' Num% = 0         ' This line needs to be uncommented (added) CountRes Type$, Num% PRINT Num% END </li>  &quot;Undefined Subprogram&quot; (Error 35)

The error occurs under either of the following conditions:

<ol style="list-style-type: lower-alpha;"> You invoke a library routine in your listing that is not in the file that you opened with the LIBRARY statement or in the resource fork of the currently open QuickBASIC source file or application.</li> A wrong trap number is used for the ToolBox statement.</li></ol>

When compiling your program, the INCLUDE MBPCs & MBLCs option must be selected if you are using any routines within the Toolbox Library. ' ***********************************************************  ' Compile this program without the INCLUDE MBPCs & MBLCs ' option selected, and the Error 35 should be generated when ' running the compiled application. ' ***********************************************************  Type$ = &quot;ICON&quot; Num% = 0 CountRes Type$, Num% PRINT Num% END </li></ol>

Additional query words: MQuickB

Keywords: KB47970

-

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

© Microsoft Corporation. All rights reserved.