Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!sunic!chalmers!tekno.chalmers.se!d83_sven_a From: d83_sven_a@tekno.chalmers.se (SVEN AXELSSON) Newsgroups: comp.sys.mac.programmer Subject: Re: Launching with Document List Message-ID: <4676@tekno.chalmers.se> Date: 9 Dec 89 10:26:03 GMT References: Organization: Chalmers Univ. of Technology, Gothenburg, Sweden Lines: 60 In article , es2q+@andrew.cmu.edu (Erik Warren Selberg) writes: > This is more of a job for luni, as he figured out how to do it... I have > some code that *won't* work 100% correctly, but it's a start (I do know > you need to set some value back to what it started as, but that's about it). > > type > {Data structure for Finder information} > FinderInfoRec = record > message: INTEGER; > > {Allocate a handled block in the SYSTEM Heap} > DocumentHandle := > FinderInfoRecHndl(NewHandleSysClear(SizeOf(FinderInfoRec))); > HLock(Handle(DocumentHandle)); > > {Fill in information about Handle^^.fileName := 'the document'; > > HUnLock(Handle(DocumentHandle)); > > {Move Handle into the AppParmHandle low mem global, $AEC} > tempLong := ORD(DocumentHandle); > BlockMove(R} > {MOVE.L A0,(SP)} > {MOVE.W D0,MemError} > Let me know if this does the trick. > Rich > > (the following was copied from MacProgrammer's West, and written (obviously) > by Rich, who's last name escapes me, but might be around) > > > ------------------/ Megalo Erik \-------------------- > GEnie: E.SELBERG | Selberg | CIS: 71470,2127 > Delphi: LORDERIK | lost in | Fido: 129/107 > BBS: 412 268 8974 | Andrew! | MacList: 6009/1 > ------------------\ help! help! /-------------------- > ...I'm being confused at CMU! This looks pretty ok to me. However, there is no need to allocate your own handle for the finder info structure. Use the one already in AppParmHandle instead, as in: extern Handle AppParmHandle : 0x0AEC; HUnlock(AppParmHandle); SetHandleSize(AppParmHandle, sizeof(FinderInfoRec)); HLock(AppParmHandle); /* stuff the data into the structure, as needed */ I have used code like this for both launching and sublaunching with a document (haven't tried with multiple documents though, but there shouldn't be any problems). I hope this helps. +-------------------------+--------------------------------+------------------+ | Sven Axelsson | d83_sven_a@tekno.chalmers.se | DISCLAIMER: | | dep:t of Linguistics | (^^ best ^^) | | | univ. of Gothenburg | dlv_sa@hum.gu.se | This is not | | SWEDEN | usdsa@seguc21.bitnet | a disclaimer. | +-------------------------+--------------------------------+------------------+