Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!world!aep From: aep@world.std.com (Andrew E Page) Newsgroups: comp.sys.mac.programmer Subject: Re: Basic Printing - Help Keywords: Print Message-ID: <1991Jun12.122831.3535@world.std.com> Date: 12 Jun 91 12:28:31 GMT References: Organization: The World Public Access UNIX, Brookline, MA Lines: 53 In article coxr@piccolo.ecn.purdue.edu (Richard L Cox) writes: > > Hello all, I am just beginning to develop and one thing which is very >important to writing applications is printing. I have read The C >Programming Primer and Inside and Can't make this simple call to the >printer and use quickdraw commands. Here is what I have (using Think C >4.0.5) > > >PrintStuff() >{ > TPPrPort myPrPort; > THPrint prRecHdl; > > PrOpen(); > PrintDefault(prRecHdl); * ^^^^^^^^^^^^^^^^^^^^^^ * * YOu may have a problem here. You never allocated prRecHdl. So in short * you just passed a piece of garbage to a routine that NEEDS a valid handle. * What you need to do is this... * * prRecHdl = (THPrint)NewHandle(sizeof(TPrint)) ; * * * Do this BEFORE calling PrintDefautl, which gives you the default fields * for the printer selected with the Chooser. * > myPrPort = PrOpenDoc( prRecHdl, NIL, NIL); > PrOpenPage(myPrPort,NIL); > > /* QuickDraw Commands */ > MoveTo( HORIZONTAL_PIXEL, VERTICAL_PIXEL ); > TextFont( 14 ); > TextFace( bold ); > TextSize( 18 ); > DrawString("\p Grateful Dead"); * ^^^^^^^^^^^^^^^ * How's about Wilson Phillips instead? * * > > PrClosePage(myPrPort); > PrCloseDoc(myPrPort); > PrClose(); > >} -- Andrew E. Page (Warrior Poet) | Decision and Effort The Archer and Arrow Concepts Enginerring | The difference between what we are Macintosh and DSP Technology | and what we want to be.