FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

FB II COMPILER

Create a faceless background application



A background app is an app that has the "background only" bit in its SIZE resource set. It can't use any of the Toolbox initialization calls except InitGraf. It has to respond to the 'quit' Apple event (otherwise there is no way to get rid of it or to restart the machine).

You can't use the full runtime for a background-only app, because it automatically initializes all the Toolbox managers; you have to use the mini-app scheme and call InitGraf yourself.

Mars


Thanks for your help. I tried using the mini-runtime, using CALL INITGRAF(REGISTER(A5)-4) and setting the SIZE flag background only to true. It's crashing every time. I'm not sure what I'm doing wrong.

Could you elaborate on how the toolbox is initialized when using background only apps? I didn't know all the managers would initialize (besides QuickDraw) simply by virtue of "Background Only" being set to true.

Aaron


I had to change the initializeApplication routine in the FB mini-app demo to:

LOCAL FN initializeApplication 'do this when the app starts up
  %REGISTER(A4)+6,_STRresID 'get ID of STR# resource
  CALL MOREMASTERS 'set aside some master pointers
  CALL MOREMASTERS 'so they're low in the system heap
END FN

And as long as you don't try to do anything fancy you will be OK. I can send you a simple shell if you still get stuck.

Jamin


When launching it, I'm getting a bus error with MacsBug telling me _InvalMenuBar+00128. In theory,the Menu manager shouldn't be initialized, but I see how it's crashing because I'm trying to call toolbox routines that aren't there. Could I see your sample shell? Thanks.

Aaron


I don't think the miniruntime sets up the QD record for you. I'd do it like this:

DIM myQD.QDGlobals
CALL INITGRAF(@myQD.thePort)


That should fix the crash.

<< Could you elaborate on how the toolbox is initialized when using background only apps?. >>

They don't initialize, which is the entire point. You can't use the Window Manager, Menu Manager, Dialog Manager, TextEdit, or any of the MacOS interface calls in an FBA - there is no interface.

The only Toolbox interface manager that is safe to use in a faceless background app is QuickDraw (since it's not exclusively for interfaces).

Mars