Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!lai From: lai@Apple.COM (Ed Lai) Newsgroups: comp.sys.mac.programmer Subject: Re: Open Document AppleEvents--Sending(2nd time) Message-ID: <54275@apple.Apple.COM> Date: 24 Jun 91 14:43:12 GMT References: <1991Jun21.130718.1@sif.claremont.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 41 The problem is in err := AECreateDesc(typeAlias, ptr(Alias^), sizeof(AliasRecord), temp); AliasRecord is just the header, so the content part of the Alias is missing. It should be err := AECreateDesc(typeAlias, ptr(Alias^), GetHandleSize(Handle(Alias), temp); The code now is correct, and it can be more compact. function CreateOpenAppleEvent (theFile: FSpecPtr; theTarget: AEAddressDesc; var theAEvent: AppleEvent): OSErr; var erateReturnID, kAnyTransactionID, theAEvent); err := AEPutParamDesc(theAEvent, keyDirectObject, temp); err := AEDisposeDesc(temp); CreateOpenEvent := err; end; {CreateOpenAppleEvent} Again error handling has been omitted. The create list has been omitted because there is only 1 item on the list. /* Disclaimer: All statments and opinions expressed are my own */ /* Edmund K. Lai */ /* Apple Computer, MS37-UP */ /* 20525 Mariani Ave, */ /* Cupertino, CA 95014 */ /* (408)974-6272 */ zW@h9cOi