home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!mcsun!sunic!kth.se!dront.nada.kth.se!d88-jwa
- From: d88-jwa@dront.nada.kth.se (Jon WΣtte)
- Subject: Re: Easiest way to find my PSN (Process Serial Number)
- In-Reply-To: ejw1@kimbark.uchicago.edu's message of Tue, 15 Sep 1992 14:46:29 GMT
- Message-ID: <D88-JWA.92Sep15204213@dront.nada.kth.se>
- Originator: d88-jwa@dront.nada.kth.se
- Sender: usenet@kth.se (Usenet)
- Nntp-Posting-Host: dront.nada.kth.se
- Organization: Royal Institute of Technology, Stockholm, Sweden
- References: <1992Sep14.213345.14845@midway.uchicago.edu>
- <x-znmmf.gurgle@netcom.com>
- <1992Sep15.144629.21586@midway.uchicago.edu>
- Date: Tue, 15 Sep 1992 19:42:13 GMT
- Lines: 36
-
- > ejw1@kimbark.uchicago.edu (Eric Weidl) writes:
-
- >> Is there any easy way to determine my own Process Serial Number?
-
- >GetCurrentProcess. There are also constants which you can stuff
- >into a PSN, but I can never remember their names, so I just call
- >the trap. :-)
-
- Of course! If I call GetCurrentProcess right after I am launched, A5 will
- be mine and I'll get my own PSN. I had been thinking about
- GetCurrentProcess, but figured that I'd call it when I needed it, ie.
- when I was in the background. At that time, it would return a PSN, but
- not mine. If I call it before entering my event loop, I'll be in the
- foreground and it should work.
-
- A5 is _always_ yours when you're getting time through WaitNextEvent,
- so unless you call GetCurrentProcess from interrupt time (or maybe
- a trap patch) you should be OK.
-
- Note that GetCurrentProcess != GetFrontProcess!
-
- Also, if you send AppleEvents to yourself, you should pass the
- constant { 0 , kCurrentProcess } for PSN when you create the
- destination descriptor. This will give you two benifits:
-
- 1) The Apple Event Manager will short-cut the event sending and
- pass it to the event handlers IMMEDIATELY (not wait for you
- to call WaitNextEvent)
- 2) Your AppleEvent will be seen by the AppleScript recording
- mechanism.
-
-
- --
- Jon W{tte, h+@nada.kth.se, Sweden, Phone +46-8-107069
-
- Help eradicate FIDO-Net <-> Usenet gateways in our time!
-