STEIN@UCONNVM.BITNET (Alan Stein) (02/20/91)
I'm making my first attempt to print using the Print Manager and am, as usual, running into problems. The relevant code I am using is below, with indications of the parts that are giving problems. I'd appreciate someone with experience using Print Manager either sending a short example of successful use of Print Manager, or taking a quick look at my code below and pointing out my errors. Also, am I correct in my understanding that one no longer needs to include support for choosing a printer directly in an application? /* Global Declarations */ word MyID; PrRecHndl printRecordHandle; GrafPortPtr printGrafPortPtr; PrStatusRecPtr statusRecPtr; /**************************************************************** * * FilePrint * ****************************************************************/ static void FilePrint () { PrJobDialog (printRecordHandle); printGrafPortPtr = PrOpenDoc (printRecordHandle,0L); PrOpenPage (printGrafPortPtr, 0L); /* print here -- no problems yet */ PrClosePage (printGrafPortPtr); PrCloseDoc (printGrafPortPtr); PrPicFile (printRecordHandle,0L,0L); } /* FilePrint */ /**************************************************************** * * FilePageSetup * ****************************************************************/ static void FilePageSetup () { if (!(printRecordHandle)) { /* This is the first place where the program fails to compile. I get a "Type Conflict" message at the end of the next line, but I can't see how my usage differs from the Toolbox Reference */ printRecordHandle = NewHandle (140L,MyID,0x8010,0x0000L); PrDefault (printRecordHandle); } PrStlDialog (printRecordHandle); } /* FilePageSetup */ /* main program */ startdesk (640); /* I bomb after quitting if I include the following statement */ MyID = GetNewID();
toddpw@nntp-server.caltech.edu (Todd P. Whitesel) (02/20/91)
Try putting a typecast on the returned handle: randomstructhandle **mystructhandle; mystructhandle = (randomstructhandle **) NewHandle( blah ); I've had to do this a lot. NewHandle is declared in memory.h as returning a Handle, which is a char **, which is of course not type-compatible with a struct **. Ah, the joys of type-casting... Todd Whitesel toddpw @ tybalt.caltech.edu
ericmcg@pnet91.cts.com (Eric Mcgillicuddy) (02/20/91)
>MyID = GetNewID(); > >From: STEIN@UCONNVM.BITNET (Alan Stein) I'm not sure how to use Print Manager, but this line is wrong. GetNewID requires a parameter, idTag see pages 14-57 and 14-58 in reference vol. 1, also see page 12-11. try this instead: MyNewID = GetNewID(idTag); ..... dostuff(); DeleteID(idTag); enddesk(); /* or whatever */ Hopefully this will help with the bomb at least. godd luck UUCP: bkj386!pnet91!ericmcg INET: ericmcg@pnet91.cts.com