Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!usc!ucsd!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: Finding the size of the screen under Multifinder/Color QD Message-ID: <33465@ucbvax.BERKELEY.EDU> Date: 4 Jan 90 16:06:47 GMT References: <10139@saturn.ucsc.edu> <9429@hoptoad.uucp> <1102@urbana.mcd.mot.com> <10164@saturn.ucsc.edu> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 50 In article <10164@saturn.ucsc.edu> sirkm@ssyx.ucsc.edu (Greg Anderson) writes: >I know it's illegal to call InitGraf() from within XCMD's, but can I >call it from within a DA? No, you can't call it from a DA either. >If I cannot call InitGraf() from within my DA, then how can I find the >size of the screen? Here is how you access the quickdraw globals from a non-application, assuming that _some_ application has set them up by calling InitGraf: (A safe assumption for D.A.s, CDEFs, MDEFs, WDEFs, CDEVs, & FKEYs) /* QuickDraw - access to globals from a code resource brought to you by David Phillip Oster (oster@well.sf.ca.us or oster@dewey.soe.berkeley.edu) You may use this as you see fit. */ typedef struct QuickDraw { LongInt randSeed; BitMap screenBits; Cursor arrow; Pattern dkGray; Pattern ltgray; Pattern gray; Pattern black; Pattern white; GrafPtr thePort; } QuickDraw; /* DisableSelf - this is from a CDEF I wrote, it dims the control. */ DisableSelf(ch)ControlHandle ch;{ QuickDraw *qd; Rect r; qd = (QuickDraw *) ( *(Byte **) CurrentA5 - (sizeof(QuickDraw) - sizeof(GrafPtr)) ); r = (**ch).contrlRect; PenMode(patBic); PenPat(qd->gray); /* <-- Note, a QD global! */ PaintRect(&r); PenNormal(); } --- David Phillip Oster -- No, I come from Boston. I just work Arpa: oster@dewey.soe.berkeley.edu -- in cyberspace. Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu