home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!decwrl!esl!stimpy!drm
- From: drm@stimpy.com (Don McGregor)
- Newsgroups: comp.sys.next.programmer
- Subject: Re: Calling Apps
- Message-ID: <1349@esl.ESL.COM>
- Date: 31 Aug 92 06:09:22 GMT
- References: <1992Aug30.172214.16435@pellns.alleg.edu>
- Sender: news@esl.ESL.COM
- Reply-To: drm@stimpy.com
- Organization: ESL, a TRW Subsidiary
- Lines: 38
- Nntp-Posting-Host: stimpy
-
- In article 16435@pellns.alleg.edu, frisinv@alleg.edu () writes:
- >
- > For an app I'm working on I need to have ImageViewer called. How do I
- >do this? How do I call any app?
-
- Drat. I just did this a few weeks ago but I don't have the code handy.
-
- Anyway, look in the documentation for the Speaker class, which
- has a brief example on sending messages to another app. Basically,
- you send a message to the Workspace with the file name. The
- Workspace then opens the appropriate application and loads the
- file. You want to message the workspace and NOT ImageViewer;
- if the user has specified another default application to look at .tiff files,
- that one should be launched instead. The Workspace manager will look
- up the appropriate app to be used for that file extension.
-
- It goes something like
-
- int fileOpened, returnCode;
- id mySpeaker = [[Speaker alloc] init];
- port_t thePort = NXPortFromName(NX_WORKSPACEREQUEST, NULL);
-
- if(thePort != PORT_NULL)
- {
- [mySpeaker setSendPort:thePort];
- returnCode = [mySpeaker openFile:"/users/bogon/foo.tiff" ok:&fileOpened];
-
- ...
- }
-
- (All code uncompiled and probably guaranteed to crash horribly).
-
- All this Mach messaging stuff is so cool, and it's gonna get even cooler.
-
- ---
- Don McGregor | "That which does not overflow my swap file
- drm@esl.com | makes me stronger."
-
-