Xref: utzoo comp.sys.amiga.tech:1404 comp.sys.amiga:21484 Path: utzoo!utgpu!attcan!uunet!cbmvax!carolyn From: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Newsgroups: comp.sys.amiga.tech,comp.sys.amiga Subject: Re: ConUnit of current console device Message-ID: <4420@cbmvax.UUCP> Date: 4 Aug 88 15:18:36 GMT References: <5403@watcgl.waterloo.edu> Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Distribution: comp Organization: Commodore Technology, West Chester, PA Lines: 48 In article <5403@watcgl.waterloo.edu> grwalter@watcgl.waterloo.edu (Fred Walter) writes: >[] > >So, how does one get a pointer to the ConUnit of the current console device ? >I need this so that I can : a) get the current x/y position of the cursor > b) get the current window size > c) get at the window title (for the filename/etc) >[] You don't say what you have to work with. If you have your own intuition window to which you have attached a console.device, the ConUnit pointer is in your iorequest after OpenDevice, in io_Unit. If you are in an AmigaDOS CON: window, you must send an ACTION_DISK_INFO packet to the console process message port. For CLI windows (and other CON: windows which have been fully set up as standard output for a process, such as the windows some of my startups create), this MsgPort is proc->pr_ConsoleTask. For plain CON: windows, you must extract the MsgPort from the DOS handle for the file. file = Open(CON:... fh = (struct FileHandle *)(file << 2); msgport = fh->fh_Type; For an example of sending an ACTION_DISK_INFO packet to a console msgport, see my ConPackets.c on Fish disk 56. Or check amiga sources group - it may be there. With 1.2 or greater CON: or NEWCON:, this packet will get you both the window pointer and the io request pointer (from which you get the ConUnit pointer). WARNINGS: Two gotchas 1. NIL: file handles have a NULL fh_Type (MsgPort). Do not send a packet to a NULL MsgPort ! 2. If your program is running in an AUX: CLI rather than a CON: or NEWCON:, the packet will succeed but you get NO valid Window pointer, and your io_Unit will NOT be a ConUnit ! -- ========================================================================== Carolyn Scheppner -- CATS Commodore Amiga Technical Support PHONE 215-431-9180 UUCP ...{uunet,allegra,rutgers}!cbmvax!carolyn Pad with zeros for a light, airy program. ==========================================================================