Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!brutus.cs.uiuc.edu!lll-winken!ames!dftsrv!chrpserv!seiler From: seiler@chrpserv.gsfc.nasa.gov (Ed Seiler) Newsgroups: comp.sys.mac.hypercard Subject: Need help with a very simple XCMD Message-ID: <739@dftsrv.gsfc.nasa.gov> Date: 25 Jan 90 03:26:32 GMT Sender: news@dftsrv.gsfc.nasa.gov Reply-To: seiler@chrpserv.gsfc.nasa.gov (Ed Seiler) Organization: Goddard Space Flight Center Lines: 33 I have a very simple example of an xcmd that I can't seem to get to work. If I invoke the xcmd from the message box of the stack it is installed in, and then "put the result", I get nothing. What am I doing wrong? I am using Think C 3.01. It seems the basic mechanics of being able to return a string work okay for another example if I call GetString(-16096) to get my Chooser name, and then call PasToZero to convert it to a null-terminated string. But trying to return a literal string as in the following example fails: #include #include "HyperXCmd.h" Handle CopyStrToHand(char *); pascal void main(paramPtr) XCmdBlockPtr paramPtr; { paramPtr->returnValue = (Handle) CopyStrToHand("This is a test string"); } Handle CopyStrToHand(str) char *str; { Handle newHndl; newHndl = (Handle) NewHandle((long) strlen(str) + 1); strcpy((char *) (*newHndl), str); return(newHndl); } This seems ridiculously simple, but I can't figure it out. Ed Seiler seiler@chrpserv.gsfc.nasa.gov