[comp.sys.mac] FKEY's from Aztec C

fry_b@husc4.harvard.edu (david fry) (12/04/86)

I have a small application that I'm trying to convert to an FKEY. My
FKEY's usually work for a little while, but end up crashing whatever
program they're running under, so I'm obviously not doing something 
right.

I'm writing this in Aztec C, which provides an option to compile
using A4 instead of A5 to access the appliation globals.  They
recommend using this for drivers and DA's so I should be using it
for FKEY's as well.  But I want to use Quickdraw globals, like
randSeed and screenBits, in my FKEY so I want to use A5 for that.

Does someone have an example of an FKEY written in C or Pascal, and
hopefully one that uses Quickdraw globals?  I'd appreciate it,
because I'd like to know how to cut this Gordian knot.

David Fry				fry@huma1.harvard.EDU
Department of Mathematics		fry@harvma1.bitnet
Harvard University			fry%huma1@harvsc4.bitnet
Cambridge, MA  02138			...!harvard!huma1!fry

rs4u#@ANDREW.CMU.EDU (Richard Siegel) (12/04/86)

I'm not familiar with Aztec C or writing FKEYs in C, but I have done some in
Pascal, and using the QuickDraw globals is very dangerous. Could you tell me
what globals you're trying to use? Generally, there are procedures to return
QD globals -- things like GetWMgrPort(gptr), which returns in gptr a pointer
to the port the window manager's using -- the screen. 

Then  you can use gptr^.portBits.baseAddr, which is a pointer to the Window
Manager Port's bitmap...

Hope this helps out...

		--Rich