Article View: comp.sys.amiga.tech
Article #10468Re: Finding The Workbench Screen
From: Jim Mackraz
Date: Thu, 01 Dec 1988 22:35
Date: Thu, 01 Dec 1988 22:35
45 lines
2089 bytes
2089 bytes
In article <1982@van-bc.UUCP> lphillips@lpami.van-bc.UUCP (Larry Phillips) writes:
)
)> How can I find the screen structure for the current Workbench
)> Screen short of opening a window on it and then looking in
)> the Window structure?
)
) Easiest path for finding the WB screen is through IntuitionBase,
)FirstScreen, Flags. Just walk the screen list until you find the
)one with the Flags bit ($0001) set. This is the WB. It's always
)been first whenever I've looked.
)
)-larry
Very terrible, Larry, on several counts. (Not that you, yourself, are a
terrible person, he disclaimed, but that this advice is quite so.)
1) The Workbench screen is only FirstScreen when it's frontmost.
2) The identifier SCREENTYPE is four bits. You would check to
see if (Flags & SCREENTYPE) == WBENCHSCREEN; Bit 0 is set for
custom screens, too (no wonder it was always the first screen).
3) Now that you have your happy pointer to the Workbench screen (if lucky),
it can be closed at any time, leaving you indirecting through free
memory. Nice. ("Oh, but how often will that happen?" the hacker asked.)
This is why GetScreenData() makes a copy of the screen, but be
aware that pointers found in the copy are not guaranteed.
4) You forgot to stress the importance of protecting your walk down a shared
list. One uses LockIBase() for this.
Your code is broken, Pal. With advice like this, who needs Multifinder?
Maybe next time.
jimm
--
Jim Mackraz, I and I Computing
amiga!jimm BIX:jmackraz
Opinions are my own. Comments regarding the Amiga operating system, and
all others, are not to be taken as Commodore official policy.
Technical Details
Message-ID:
<3159@amiga.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!ames!oliveb!amiga!jimmReferences:
<1982@van-bc.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!ames!oliveb!amiga!jimm From: jimm@amiga.UUCP (Jim Mackraz) Newsgroups: comp.sys.amiga.tech Subject: Re: Finding The Workbench Screen Message-ID: <3159@amiga.UUCP> Date: 1 Dec 88 22:35:27 GMT References: <1982@van-bc.UUCP> Reply-To: jimm@cloyd.UUCP (Jim Mackraz) Organization: Commodore-Amiga Inc, Los Gatos CA Lines: 45