Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!spool.mu.edu!munnari.oz.au!manuel!ccadfa!prolix!dac From: dac@prolix.pub.uu.oz.au (Andrew Clayton) Newsgroups: comp.sys.amiga.programmer Subject: Re: RASTPORT from ML Message-ID: <18d795f0.ARN13c0@prolix.pub.uu.oz.au> Date: 17 Mar 91 10:43:28 GMT References: <65143@eerie.acsu.Buffalo.EDU> <18d51307.ARN1309@prolix.pub.uu.oz.au> <1991Mar16.121732.3678@ida.liu.se> Reply-To: dac@prolix.pub.uu.oz.au Followup-To: comp.sys.amiga.programmer Organization: More like Mis~, really. Lines: 45 In article <1991Mar16.121732.3678@ida.liu.se>, Rickard Westman writes: > dac@prolix.pub.uu.oz.au (Andrew Clayton) writes: > >In article <65143@eerie.acsu.Buffalo.EDU>, Jeffrey C Murphy writes: > > >> How do you locate the rastport value from machine language if > >> your program is using the cli as the output window? > > >(***************************************************************************) > > intbase := IntuitionBase; (*All this hassle to get*) > > windowptr := intbase^.ActiveWindow; (*the magic item for DrawImage*) > > rport := windowptr^.RPort; (*called the RastPort!*) > >(***************************************************************************) > > >Good luck. > > Probably, he'll need it. ;-) > > You (or the one who wrote that code) assume that the console window of > the current process is also the active window. This may be true in > most cases, but clearly not in every case. The user could, for > instance, deactivate the CLI window in which your program is run from > a script. The Amiga will happily crash and burn if you use NULL as a > window pointer... Sure will. My one 'serious' program (Journal) uses that very lump of code, and does indeed crash and burn if you start it up in background with anything that causes it to display it's error graphic [yeah, yeah, graphics in a CLI rastport is pretty tacky, but I thought it was cute]. > The only *right* way to do this is a bit more complex than your > suggestion. You'll have to send a DiskInfo packet (ACTION_DISK_INFO = 25L) > to the console handler ((struct MsgPort *)process->pr_ConsoleTask)). > In return, you will get a window pointer in the id_VolumeNode field, > and some other useful info. Thanks. Someone posted similar information to me a few months ago, and I have lost it within 24Mb of assorted LHARCed archives :-(. I'll save this one in my source directory so that I can fix up Journal. > Rickard Westman, University of Linkoping, Sweden Dac David Andrew Clayton. // _l _ _ dac@prolix.pub.uu.oz.au *or*|I post.I am. Canberra, Australia.\X/ (_](_l(_ ccadfa.cc.adfa.oz.au!prolix!dac@munnari.oz