[futurebasic] Re: Two questions for MacOS gurus.

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 1998 : Group Archive : Group : All Groups

From: Deb Lake <deblake1@...>
Date: Sun, 01 Feb 1998 19:54:47 -0500
Mark Goodes said:
>1.  I'd like to be able to get the window list for the current frontmost
>application from a code resource, and even better, for any application that
>is running (I think the Toolbox keeps a separate window list for each
>application).

Mars said:
(Too many fantastic things to relate. Is he wonderful, or what!!)

I'm not sure exactly what your appl is after, but I'm working on
something that sounds kinda similar and maybe something here will help.

To get a list of windows for the current appl:

On entry/start-up:

A.) ON TIMER(1) = a Process Manager routine to poll for process changes
-- for the sake of argument we'll call it FN getCurrentProcess.

B.) Install a jGNEFilter so that calls to FN FRONTWINDOW will be vaild.

From FN getCurrentProcess, you'll be able to keep track of appls as
they're switched in and out. If you find a process that you're
interested in then you can set a global boolean value to _true which
triggers your event handler from the jGNEFilter to start looking at
windows. And you'll look at windows  with wPtr&=FN FRONTWINDOW. The
pointer returned contains the window information plus a pointer to the
next window (in the offset wPtr&.nextwindow.) So it's easy to get all
the windows by setting up a little loop until wPtr&.nextwindow=0. 

Maybe Mars or Staz can correct me if I'm wrong, but I *believe* that FN
FRONTWINDOW only points to windows for the currently running process. My
code is pretty much only concerned with that front window so I've never
really tracked the chain of nextwindows. But even if it points to all
the open windows then you can easily weed out the ones that you have
already tracked.

As Mars pointed out, use of the jGENFilter can be unfriendly -- and I'm
going to take a look at his alternative. But, what I've done thus far
works great (it's placed in the start up folder and has no user exits).
If you would like some sample code, I'll tidy-up some of what I've got.

DL