Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!widener!ukma!memstvx1!utkcs2!emory!sol.ctr.columbia.edu!caen!etsu!cmi.com!davet From: davet@cmi.com (David Temkin) Newsgroups: comp.sys.mac.programmer Subject: Re: How do I get the slot number for the _MAIN_ Screen? Message-ID: <10384@etsu.CMI.COM> Date: 8 May 91 14:27:53 GMT Sender: news@etsu.CMI.COM Organization: Center for Machine Intelligence, EDS Corp. Lines: 31 References:<1991May7.145602.21514@milton.u.washington.edu> <1991May7.202841.23551@eng.umd.edu> In article <1991May7.202841.23551@eng.umd.edu> russotto@eng.umd.edu (Matthew T. Russotto) writes: > In article <1991May7.145602.21514@milton.u.washington.edu> busey@milton.u.washington.edu (Thomas Busey) writes: > >I'm sure that this question has been asked before, but how do I get > >the slot number for the Main screen (i.e. the one with the menu > >bar in it). Thanks for responding. > > foo() > { > GDHandle gd; > int mainslot > > gd = GetMainDevice(); > mainslot = (*GetADCtlEntry((*gd)->gdRefNum))->dCtlSlot > } etc, etc. Alternately, you can call GetMainDevice() and then get the base address of the pixmap -- either through the PixMap record directly, or, if 32-bit QuickDraw is installed, through GetPixBaseAddr(). The base address is of the form FsXXXXXX (hex), and the second hex digit (s) is the slot number. (This is documented in Designing Cards & Drivers). David Temkin Center for Machine Intelligence, EDS Corp. davet@cmi.com