[comp.sys.amiga] Finding address of active screen?

MCARTSHA@UREGINA1.BITNET (Shan Mcarthur) (03/03/90)

Hi.  I am writing a program that I would like to be able to program it
to pop up a window in a screen that does not belong to the program.  How
would I during the initialization of my program, go about finding an
address to the appropriate screen structure.  I was thinking of having
the program delay three secs for the user to switch screens and then
use the one that is then active.  Or, if that is not possible, have the
user enter as an argument, the name of the screen to use.  Please respond
to MCARTSHA@UREGINA1.  Thank you VERY much for your help.  If you are
also interested in any responses I get to this question, mail me and I
will forward the answers.

Shan

wfh58@leah.Albany.Edu (William F. Hammond) (03/03/90)

In article <9003021936.AA21794@jade.berkeley.edu>, MCARTSHA@UREGINA1.BITNET (Shan Mcarthur) writes:
> would I during the initialization of my program, go about finding an
> address to the appropriate screen structure.  I was thinking of having
/*  ints are long  */
. . .
struct NewWindow new;
struct IntuitionBase *IntuitionBase;
struct Screen *ascr;
struct Window *wdw;
. . .
main()
{
. . .
ULONG ilock = 0L;
IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
if(IntuitionBase==NULL)
   getout(20);   /*  Close anything already opened  */
ilock = LockIBase((ULONG)0L);  /*  Don't dally with intuitionbase locked  */
ascr = IntuitionBase->ActiveScreen;
if(ascr==NULL)
   {
   UnlockIBase(ilock);
   getout(25);
   }
/*  Presumably you want to read screen characteristics before setting  */
/*  the parameters in your new window                                  */
/*  Otherwise, it's better to set the new window stuff before locking  */
/*  intuitionbase.                                                     */
new.LeftEdge = . . .
new.TopEdge = . . .
. . .
new.Screen = ascr;
. . .
new.Type = CUSTOMSCREEN;
wdw = (struct Window *)OpenWindow(&new);
UnlockIBase(ilock);
if(wdw==NULL)
   getout(22);
rp = wdw->RPort;  /*  Now we're open for business  */
. . .
getout(0);
}
   Good luck.    -- Bill  
----------------------------------------------------------------------
William F. Hammond                   Dept. of Mathematics & Statistics
518-442-4625                         SUNYA, Albany, NY 12222
wfh58@leah.albany.edu                wfh58@albnyvms.bitnet
----------------------------------------------------------------------