Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!deimos!uxc!uxc.cso.uiuc.edu!uxg.cso.uiuc.edu!uxe.cso.uiuc.edu!leonardr
From: leonardr@uxe.cso.uiuc.edu
Newsgroups: comp.sys.mac.programmer
Subject: Re: Passing info when transfering
Message-ID: <226000033@uxe.cso.uiuc.edu>
Date: 4 Dec 88 22:08:00 GMT
References: <5446@polya.Stanford.EDU>
Lines: 45
Nf-ID: #R:polya.Stanford.EDU:5446:uxe.cso.uiuc.edu:226000033:000:2796
Nf-From: uxe.cso.uiuc.edu!leonardr    Dec  4 16:08:00 1988


rothberg@polya.Stanford.EDU(Ed Rothberg) writes in comp.sys.mac.programmer

>I'm writing a piece of software which consists of three applications, with
>the ability to easily transfer between them.  I need to be able to tell
>if an application is started up via transfer, and if so I want to pass a
>bit of information from the transfering application to the transferee.
>Is there an elegant way to do this?
>
>Right now, I use the Scrap to pass the info.  While this works fine, it
>has the obnoxious side-effect of wiping out what was previously in the
>scrap without the user having ever issued a command which would obviously
>have this effect (i.e. Cut, Copy).  It seems that what I want to do is
>put the info into the system heap, but I can't seem to figure out how to make
>it identifiable once it's there.  I can't make it a simple handle, since
>the application starting up won't have any way to find it.  I can't make
>it a resource, since then it will get added to the resource file.  Is there
>any good way to do this?
>
	Another distinct problem that you are forgetting with using the scrap is
the wonderful world of MultiFinder which DOES NOT convert the scrap betwseen
applications automagically.  You application must do this itself!

	You are correct that you want to put the data into the System Heap as the 
method for mainting data 'links' between applications (until Apple gives up
IPC or IAC).  You should be using resources as this is anice doucmented method
for doing what you want.  I think what you are missing about resources is that
when you you do a AddResource which marks the handle as a 'Resource Handle'
it DOES NOT add the resource to the file, it simple marks the resChanged bit
so that when a WriteResource or UpdateResFile is done it is added to the file.
If you do neither of the above (Write or Update) then the resource is not added
to the resource file, but is still in the System Heap.
	The other possibility is to use the method described by Paul Snively and 
Frank Alviani in the last couple MacTutors for doing your own IPC/IAC.

+---------------------------------+-----------------------------------+
+                                 +  Any thing I say may be taken as  +
+   Leonard Rosenthol             +  fact, then again you might decide+
+   President, LazerWare, inc.    +  that it really isn't, so you     +
+                                 +  never know, do you??             +
+   leonardr@uxe.cso.uiuc.edu     +                                   +
+   GEnie:  MACgician             +  MacNET: MACgician                +
+   Delphi: MACgician             +  AppleLink: D0025                 +
+                                 +                                   +
+---------------------------------+-----------------------------------+