[comp.sys.mac.programmer] Help me cheat!

ml10+@andrew.cmu.edu (Michael A. Libes) (11/28/89)

Does anyone know how to "force" a window in another program to update,
without any user input?
I am trying to write a screen saver as a Multifinder application (just
for fun) and the only problem I've come across is getting the menubar
and the windows of the foreground application to update.  How do the
normal screen savers do it?  Must I patch a toolbox call?
Also, it would be great if I could get the list of windows.  The low
memory global, WindowList, is always null in Multifinder.  Where did
Apple move it?

I understand that everything I'm doing to against Apple's guidelines,
but I much prefer a cheating Multifinder app to any INIT.

        -luni (ml10@andrew.cmu.edu)

lemke@radius.UUCP (Steve Lemke) (11/29/89)

In article <UZQV1=C00UhW43Zloz@andrew.cmu.edu> ml10+@andrew.cmu.edu (Michael A. Libes) writes:
}Does anyone know how to "force" a window in another program to update,
}without any user input?
}I am trying to write a screen saver as a Multifinder application (just
}for fun) and the only problem I've come across is getting the menubar
}and the windows of the foreground application to update.  How do the
}normal screen savers do it?  Must I patch a toolbox call?

Try the following code to invalidate the whole screen - that includes all
windows open, I think.  Anyway, after writing all over the whole screen,
my program does the following to update everything.

 procedure InvalScreen; { invalidates the whole screen }
  var
   oldPort: GrafPtr;
   bfRgn: RgnHandle;
   bfRect: Rect;
 begin
  GetPort(oldPort);
  bfRgn := NewRgn;
  SetRect(bfRect, -32000, -32000, 32000, 32000);
  RectRgn(bfRgn, bfRect);
  PaintBehind(WindowPeek(FrontWindow), bfRgn);
  DisposeRgn(bfRgn);
  SetPort(oldPort);
 end;

}Also, it would be great if I could get the list of windows.  The low
}memory global, WindowList, is always null in Multifinder.  Where did
}Apple move it?

Don't bother - just try the above code.

-- 
----- Steve Lemke, Engineering Quality Assurance, Radius Inc., San Jose -----
----- Reply to: radius!lemke@apple.com    (Coming soon: radius.com ...) -----
----- AppleLink: Radius.QA;    GEnie: S.Lemke;    Compu$erve: 73627,570 -----

es2q+@andrew.cmu.edu (Erik Warren Selberg) (11/29/89)

Luni --
 
aren't you looking for DrawMenuBar() ?
 
btw: for a complete list of windows, check out the WindowRecord record. 
Notice something
along the lines of nextWindow:windowPtr?  You can do a recursive call to
get the next window fairly easily (I have some code if you like).  All
you need to do really is call FrontWindow(), and then play with some
pointers.

------------------/ Megalo Erik \--------------------
GEnie:  E.SELBERG |   Selberg   |     CIS: 71470,2127
Delphi: LORDERIK  |   lost in   |       Fido: 129/107
BBS: 412 268 8974 |   Andrew!   |     MacList: 6009/1
------------------\ help! help! /--------------------

...I'm being confused at CMU!

lsr@Apple.COM (Larry Rosenstein) (11/30/89)

In article <1213@radius.UUCP> lemke@radius.UUCP (Steve Lemke) writes:
> windows open, I think.  Anyway, after writing all over the whole screen,
> my program does the following to update everything.
> 
>  procedure InvalScreen; { invalidates the whole screen }

I think this will only invalidate the whole screen if your application is 
frontmost.  

Larry Rosenstein, Apple Computer, Inc.
Object Specialist

Internet: lsr@Apple.com   UUCP: {nsc, sun}!apple!lsr
AppleLink: Rosenstein1

ml10+@andrew.cmu.edu (Michael A. Libes) (11/30/89)

It seems that this is no way, short of a trap patch, to get the entire
screen to update.  Since I don't like patches, head or tail, I rethought
the problem and came up with a way to get my program to be in the
foreground just long enough to open and close a window.
Thanks for all the suggestions anyway.

    -luni