Microsoft KB Archive/36334

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


When Macintosh QuickBASIC 1.00 Might Forget Compiler Options

Article ID: 36334

Article Last Modified on 11/21/2006

This article was previously published under Q36334

SUMMARY

You can change the default compiler options under Options... in the Run menu of Microsoft QuickBASIC Version 1.00 for Apple Macintosh. QuickBASIC saves the compiler options in the MBCO resource in each source file.

QuickBASIC may not remember a program's compiler options correctly under one of the following conditions:

  1. If there is more than one MBCO resource in the resource fork of either the program source file or QuickBASIC
  2. If there is an MBCO resource in the "QuickBASIC Settings" file (the "QuickBASIC Settings" file may be found in the System folder)

These may be determined by opening the file in question with ResEdit, which is on the Examples disk in the Tools folder. To see if there is more than one MBCO, double click on MBCO.

To correct situation 1, do the following:

If there are extra MBCOs in the source file, use ResEdit to delete all of the MBCO resources in the file. If there are extras in QuickBASIC, delete all but one.

To correct situation 2, do the following:

Drag the "QuickBASIC Settings" file from the System folder into the desktop trash can.

MORE INFORMATION

Situation 1 or 2 may occur when you are developing a program in the environment that opens external resource files with OpenResFile, the ToolBox statement or the LIBRARY statement. Situation 1 or 2 may also occur if your program closes its own resource fork.

In general, NEVER close the resource fork of any file you did not open yourself. NEVER close the resource fork of a currently running application, whether that application is QuickBASIC or your own application. ALWAYS close external resource files you have opened before you END, STOP, RUN, CHAIN, or SubLaunch.

When you are developing a program that works with resources files, you should include an ON BREAK statement. The ON BREAK handler and the normal termination code for your program should include code similar to the following:

ON BREAK GOSUB breakTrap : BREAK ON
' Program code goes here ...
' ...
IF timeToQuit THEN GOTO BreakTrap
END
BreakTrap:
    '    close open libraries:
    LIBRARY CLOSE

    ' Do the following for every resource file you have opened.
    ' This code checks to make sure the given resource file is
    ' NOT the program source file or the currently running
    ' application, then closes the resource file.
    ' ref% is the number returned by OpenResFile.
    ' PEEKW(&H900) gets the file reference number of the currently
    ' running application from the Macintosh global variable
    ' CurApRefNum.
    IF ref% <> SYSTEM(7) AND ref% <> PEEKW(&H900) THEN
        CloseResFile ref%
    END IF
    STOP
                


Additional query words: MQuickB

Keywords: KB36334