Important: The information in this document is obsolete and should not be used for new development.
Sending and Forwarding Messages
Message objects can send a printing message to other clients in the message chain. When a message is sent, QuickDraw GX receives it and sends it to the first message handler in the chain. In Figure 6-2 this is the application.QuickDraw GX provides two methods of sending messages. You can use a statement with the format:
anErr = Send_GXMessageName(arguments);A typical example is
anErr = Send_GXCompleteSpoolFile(theSpoolFile);Alternatively, you can use theSendMessagefunction to send a specified message to the top of the message chain.You can use the
ForwardMessagefunction to specify the message to be forwarded to the next message handler. This function takes a selector that indicates the message to be forwarded and has parameters that are message-specific.For example, a four-up printing extension that maps four document pages onto one physical page at print time may require that the
GXCountPagesmessage be forwarded. TheGXCountPagesmessage has the following interface:
OSErr GXCountPages (gxSpoolFile thePrintFile, long* numPages);You can use theForwardThisMessagefunction to forward the current message to the next message handler.
anErr = ForwardThisMessage(gxCountPages, thePrintFile, &numPages);All the QuickDraw GXForward_xxxfunctions, wherexxxis the QuickDraw GX printing message to forward, are in-line aliases to theForwardThisMessagefunction with the message-specific parameters added for type-checking purposes. An example of the recommended format for forwarding a message is:
anErr = Forward_GXCountPages(thePrintFile, &numPages);TheSendMessagefunction is described on page 6-23. TheForwardMessagefunction is described on page 6-24. TheForwardThisMessagefunction is described on page 6-25.Printing messages are described in the "Printing Messages" chapter of Inside Macintosh: QuickDraw GX Printing Extensions and Drivers.