home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15499 < prev    next >
Encoding:
Text File  |  1992-09-15  |  2.9 KB  |  62 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!kimbark!ejw1
  3. From: ejw1@kimbark.uchicago.edu (Eric Weidl)
  4. Subject: Re: Easiest way to find my PSN (Process Serial Number)
  5. Message-ID: <1992Sep15.144629.21586@midway.uchicago.edu>
  6. Sender: news@uchinews.uchicago.edu (News System)
  7. Reply-To: ejw1@midway.uchicago.edu
  8. Organization: Academic and Public Computing
  9. References: <1992Sep14.213345.14845@midway.uchicago.edu> <x-znmmf.gurgle@netcom.com>
  10. Date: Tue, 15 Sep 1992 14:46:29 GMT
  11. Lines: 49
  12.  
  13. In article <x-znmmf.gurgle@netcom.com> gurgle@netcom.com (Pete Gontier) writes:
  14. >ejw1@kimbark.uchicago.edu (Eric Weidl) writes:
  15. >
  16. >>    Is there any easy way to determine my own Process Serial Number?  
  17. >
  18. >GetCurrentProcess. There are also constants which you can stuff
  19. >into a PSN, but I can never remember their names, so I just call
  20. >the trap. :-)
  21.  
  22. Of course!  If I call GetCurrentProcess right after I am launched, A5 will be 
  23. mine and I'll get my own PSN.  I had been thinking about GetCurrentProcess,
  24. but figured that I'd call it when I needed it, ie. when I was in the 
  25. background.  At that time, it would return a PSN, but not mine.  If I call it 
  26. before entering my event loop, I'll be in the foreground and it should work.
  27.  
  28.  
  29. >>    The reason I want to know my PSN is so that I can call
  30. >>SetFrontProcess() to bring myself to the foreground in response to an 
  31. >>AppleEvent.  I've tried every combination of parameters in AESend() and 
  32. >>AEInteractWithUser(), but to no avail. So, I thought I'd try
  33. >>SetFrontProcess.
  34. >
  35. >This will certainly work, and I'm no expert on AE, but I believe the
  36. >idea is to let the sender of the event decide whether your app should
  37. >come to the front. Perhaps forcing your app to the front is not a
  38. >desirable effect.
  39.  
  40. We are working on a gopher client which uses a number of different apps to 
  41. view different file types.  The different apps communicate via AppleEvents. 
  42. Since the applications act as a suite, and I know who is asking me to open 
  43. a document and why, I'm taking liberties with interaction levels, etc.  
  44.  
  45. I looked at the Sender and Reciever examples apps on the Developer's CD and 
  46. determined that the correct set of parameters to bring an app to the 
  47. foreground was: Reciever app, kAEInteractWithAll (or kAEInteractWithLocal), 
  48. and then call AEInteractWithUser(); Sender app, kAECanInteract (or 
  49. kAEAlwaysInteract), kAEWaitReply, and kAECanSwitchLayer.  With this 
  50. conbination of bits, the Reciever app comes to the foreground when it recieves 
  51. the AppleEvent, but my app doesn't.
  52.  
  53. >-- 
  54. > Pete Gontier // EC Technology // gurgle@netcom.com
  55.  
  56. Eric
  57. -- 
  58. ===================================================================
  59.                Eric Weidl    e-weidl@uchicago.edu
  60.       University of Chicago -- Academic and Public Computing
  61. ===================================================================
  62.