Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!rpi!uupsi!sunic!liuida!d88ricwe From: d88ricwe@odalix.ida.liu.se (Rickard Westman) Newsgroups: comp.sys.amiga.programmer Subject: Re: RASTPORT from ML Message-ID: <1991Mar16.121732.3678@ida.liu.se> Date: 16 Mar 91 12:17:32 GMT References: <65143@eerie.acsu.Buffalo.EDU> <18d51307.ARN1309@prolix.pub.uu.oz.au> Sender: news@ida.liu.se (News Subsystem) Organization: CIS Dept, Univ of Linkoping, Sweden Lines: 42 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... 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. For example code, look at Fred Fish #35. I haven't seen this code myself, but I assume it's written in C, so you will have to convert it to machine language. Fish 35: ConsoleWindow ====================== Example program for finding the Intuition pointer to an AmigaDos CON: or RAW: window, so you can do WindowToFront, graphics, and other interesting things. (Requires AmigaDos 1.2) Author: Andy Finkel and Robert Burns -- Rickard Westman, University of Linkoping, Sweden