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

SYSTEM

About INIT


I am in the very early stages of developing a concept into software. I want to trap some toolbox calls (specifically CALL TEXTFACE, and others related) and handle them before they are passed to the toolbox. I have no idea how to do this. I assume this has to be done with an extension (INIT). The other problem is that I need to implement a user interface to allow some preferences setting to be made. I assume this will have to be done with a Control Panel. Will these (Control Panel/INIT) work together (via some global address?) or can a Control Panel trap toolbox calls without needing an extension. I've looked at the code samples provided with FBII. It looks like enough to get started, but some input from the experts would be very much appreciated. Thanks in advance!

John M.


I've been working on a similar project for some time now (although with other toolbox calls). It takes a lot more work than it seems at first, especially if you want to accomplish more than one patch in the same code resource.

I recommend that you take it in small steps. Start with the FB INIT shell and use it to install your TEXTFACE patch. Then write your control panel. Then read Dave Mark's chapter on INITs in "Ultimate MacIntosh Programming" to find out how to combine INITs and control panels. Then try using his technique of installing a custom gestalt selector to get the INIT and control panel to talk to one another. Then, if you want to patch more than one trap, make a post and I'll give you the technique that took me zillions of system crashes to figure out.

WARNINGS:
1. It really helps to set up a RAM disk and install a minimal system on it (I'm using 7.6). Then if your patch destroys the system file you still have your main system file on your hard drive. This also immensely speeds up the many restarts that you will want to do when testing your INIT.
2. If you want to write INITs in FB, you need a basic working knowledge of assembler. You'll need to be like those bilingual people who switch from one language to another when they talk to each other.
3. Expect to spend a great deal of time on this.

wave


You may patch the low level hooks in the application heap (not the toolbox) or you may use custom links in Text Edit. You can find an example of how this is accomplished in PG since it is the method used to create inverted, strike thru, super-script, and sub-script styles.

-STAZ ~)~