Common MBLC Toolbox Programming Errors in Macintosh QuickBASIC (47970)






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. "Invalid Function Call" (Error 5)
  2. "Type Mismatch" (Error 13)
  3. "Undefined Subprogram" (Error 35)
Common programming mistakes that cause these errors are described further below. This information is taken from Page 524 of the "Microsoft QuickBASIC for Apple Macintosh: Language Reference" manual.

MORE INFORMATION

  1. "Invalid Function Call" (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 "12345".
       ' ************************************************************
       Type$ = "12345"
       Num% = 0
       CountRes Type$, Num%
       PRINT Num%
       END
    						
  2. "Type Mismatch" (Error 13)

    This error can occur under any of the following conditions:

    1. You invoke an MBLC library statement and pass a variable that hasn't been previously defined (initialized).
    2. Not enough variables follow the routine name.
    3. A library statement name is incorrectly declared as a string with a DEFSTR statement.
    4. A passed parameter is of the wrong type.
    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 ("") for string variables.
       ' ************************************************************
       ' This program gives a Type Mismatch error because the
       ' Num% is not initialized to 0 before making the call.
       ' ************************************************************
       Type$ = "ICON"
       '  Num% = 0         ' This line needs to be uncommented (added)
       CountRes Type$, Num%
       PRINT Num%
       END
    						
  3. "Undefined Subprogram" (Error 35)

    The error occurs under either of the following conditions:

    1. 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.
    2. A wrong trap number is used for the ToolBox statement.
    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$ = "ICON"
       Num% = 0
       CountRes Type$, Num%
       PRINT Num%
       END
    						

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB47970