FB II Compiler
Understand what is a background application
A background app id simply a faceless app. That is it has no menubar, no windows, and can't easly interact with a user.
The usual term for these beasts is "FBA", meaning "faceless background app." You can turn an application into an FBA by setting the "Background only" bit in its SIZE resource. That's all there is to it.
An FBA has to live under certain restrictions that don't apply to regular apps. You cannot call any user interface calls, especially INITWINDOWS.
This is more of a problem than it might seem - the FB runtime calls INITWINDOWS at startup. Thus you cannot use the regular FB runtime to create an FBA; you must use the mini-runtime.
FBAs *must* support at least the 'quit' Apple event. That is the only way to shut an FBA down. If your FBA does not support the 'quit' event, it will be impossible to restart the Mac once it has started up.
FBAs run a regular WaitNextEvent loop. They can send and receive Apple events, have their own memory space, and are basically just a regular app that doesn't have an interface. This makes them a *much* *much* nicer working environment than the traditional INIT.
FBAs cannot install global trap patches, however. If you want to do that, you still have to write an INIT.
An FBA of type 'APPL' looks like a regular application, except that once you've launched it, you return to the Finder and that's it. But an FBA of type 'appe' looks and acts like an extension. It gets executed at startup (after the "Welcome to Mac" screen but before the desktop shows up) and the Extensions Manager treats it like an extension.
[Slightly off topic: in MacOS 7.6.1 and above, an application of type 'appc' will look and act like a control panel. You can do anything you like; it's up to you to make it feel like a control panel. Guess this is so the cdev writers don't get jealous of the ex-INIT writers.]
Go to Jamin's FutureBasic page: http://www.ozemail.com.au/~benjamen and download the faceless Background Application sample code.
This is from his site
"This source is a modified form of the mini-runtime code supplied with FB. It will allow you to create a Faceless Background Application / Background Only Application. Note that you must use the mini-runtime for this to work.
You might be able to create an Application Extension by changing the output type to "appe" "
The direct download link is: http://www.ozemail.com.au/~benjamen/BOA_FBA_in_FB.sit.hqx