[comp.sys.mac.programmer] Getting an appl. and its doc's to relate...

commons@Sunburn.Stanford.EDU (Peter Commons) (07/31/90)

Can anyone tell me what I need to do so that the following two app/doc 
relations will work?

1) So that if I do "get info" on a document for my application, it will say
"An <appl name> document".

2) So that if I double click on the document, it will run my application and
"open" the document.

I've already created the bndl, fref, icn#, and personal sig. resources. The
application and documents have their own icons, but that doesn't seem to help
with the above two problems.

Thanks in advance.

--
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|   Peter Commons			"Zut, alors! I have meesed one!!!"    |
|   commons@cs.stanford.edu						      |
|   Computer Science Department, Stanford University			      |

stevec@Apple.COM (Steve Christensen) (07/31/90)

In article <1990Jul30.172925.11682@Neon.Stanford.EDU> Peter Commons writes:
>Can anyone tell me what I need to do so that the following two app/doc 
>relations will work?
>
>1) So that if I do "get info" on a document for my application, it will say
>"An <appl name> document".

The document's type and creator must be setup correctly.  For example, if
your app's type and creator are "APPL" and "MYAP" respectively, your document
would have to have a type and creator of "ADOC" and "MYAP", i.e., the
creators need to match.

Also, as far as required resources go, you'll need the following:

BNDL 128	creator="MYAP" and includes references to:
		- "ICN#" 128	(app's icon)
		- "ICN#" 129	(doc's icon)
		- "FREF" 128	(app's file ref)
		- "FREF" 129	(doc's file ref)

FREF 128	type="APPL", localID=0, filename=""
FREF 129	type="ADOC", localID=1, filename=""

ICN# 128	(app's icon)
ICN# 129	(doc's icon)

>2) So that if I double click on the document, it will run my application and
>"open" the document.

If Get Info thinks that the document belongs to your application, then it
will run your app and pass some info to it regarding the file name, etc.
All the specifics about this can be found in the Segment Loader chapter of
Inside Mac, volume 2.  Specifically see CountAppFiles(), GetAppFiles(), and
ClrAppFiles().

steve

-- 
____________________________________________________________________

  Steve Christensen             Internet:   stevec@goofy.apple.com
  Apple Computer, Inc.          AppleLink:  STEVEC
  20525 Mariani Ave, MS 81-CS   CompuServe: 76174,1712
  Cupertino, CA  95014

  "You just contradicted me."  "No I didn't."
____________________________________________________________________