[comp.sys.mac.programmer] Suspend Resume events.. how?

stuartb@microsoft.UUCP (Stuart Burden) (05/11/89)

Could someone kindly point me to some information (or give me a pointer or
two) on how to implement recognition on suspend/resume events.

I need to know when I am not the forground application, and I gather
that by looking for a suspend event when I'm switched out is what I should
be doing.  I've looked at both skimpy references to suspend/resume 
events in the tech notes and can find no reference to them at all in IM.

Any help would be appreciated.  Thanks.

Stu.

__Paths to my door:_______________________
microsoft!stuartb@beaver.cs.washington.edu  -   Usual disclaimer, that all
microsoft!stuartb@uw-beaver.arpa            -   the above is pure fantasy
microsoft!stuartb@uunet.UU.NET              -       and Microsoft only
[DE01HB]stuartb@DASNET#   {from AppleLink}  -    gave me the Mountain Dew
stuartb@microsoft.uucp    {well connected}  -      to dream it all in a
D2012 {@applelink.apple.com - shared acct}  -        caffeine haze :-)
__________________________________________________________________________

jackiw@cs.swarthmore.edu (Nick Jackiw) (05/12/89)

In article <5693@microsoft.UUCP> stuartb@microsoft.UUCP (Stuart Burden) writes:
> Could someone kindly point me to some information (or give me a pointer or
> two) on how to implement recognition on suspend/resume events.
> 

In order to ever see them, you'll have to create a SIZE ID=-1 resource,
and--in ResEdit--set the "Accept Suspend Events" and "Multifinder Aware"
bits. 

Once you've done this, your program can assume initially (i. e. prior to
your event loop) that you're switched _in_ (I've yet to find a way of 
launching apps in the background, unless they're background-only sort of
things like PrintMonitor). Your event loop should watch for app4Evts, 
which MultiFinder will post to it.  The event.message field tells whether
you're going out or in, and whether your clipboard needs conversion
(from some weird private format you implement to public TEXT or PICT scraps).

	Bit	Meaning
	0	0=Suspend; 1=Resume
	1	0=Conversion  not required; 1=Convert to public formats

	2-n	reserved

And that's it.  I think if you don't set MFAware, but DO set AcceptsSuspends,
then your application will receive activate and deactivate events for its
top window as its being switched in or out as well.  I'm not sure.

-Nick.



> Any help would be appreciated.  Thanks.
> 
> Stu.
> 
> __Paths to my door:_______________________
> microsoft!stuartb@beaver.cs.washington.edu  -   Usual disclaimer, that all
> microsoft!stuartb@uw-beaver.arpa            -   the above is pure fantasy
> microsoft!stuartb@uunet.UU.NET              -       and Microsoft only
> [DE01HB]stuartb@DASNET#   {from AppleLink}  -    gave me the Mountain Dew
> stuartb@microsoft.uucp    {well connected}  -      to dream it all in a
> D2012 {@applelink.apple.com - shared acct}  -        caffeine haze :-)
> __________________________________________________________________________


-- 
     _  _|\____    Nick Jackiw | Visual Geometry Project | Math Department
   / /_/   O>  \   ------------+-------------------------+ Swarthmore College
   |       O>   |  215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081
    \_Guernica_/   ------------+-------------------------+                 USA