Specifications

CHAPTER 4
Software Support
76 Passing Messages
structure. The driver passes the message’s 16-bit command and the two 32-bit
parameters to your message handler. Refer to “Installing a Message Handler on the Mac
OS” on page 76 and “Installing a Message Handler on the PC System” on page 77 for
information about about the format of the MsgRecElem data structure.
The message handler examines the command and parameters and determines whether
there is any data to be received. If there is, the handler passes back a pointer to the
MsgBlk data structure. The interface driver then receives the data and puts it into the
buffer pointed to by msgBuffer. The driver then updates msgActCount with the
number of bytes of data received and sets msgResult to 0 (no error), –1 (MsgOverrun),
–2 (MsgUnderrun), or –3 (MsgTimeout). The driver then calls your completion routine,
if there is one.
A message handler is described by a MsgRecElem record. The recProc field points to
the handler procedure. The values of recBaseCmd and recCmdCount are the values
allocated by rsRegisterMessage.
IMPORTANT
Before your application terminates, you must remove your message
handler so that the interface driver will not call it after the application
has terminated. See “Removing a Message Handler” on page 78 for
more information.
Installing a Message Handler on the Mac OS 4
To install a message handler on the Mac OS, build a MsgRecElem record and pass a
pointer to it in a control call to the interface driver. The MsgRecElem data structure for
applications on the Mac OS has the following format:
MsgRecElem RECORD 0
recQLink DS.1 1 ; Next queue element
recQType DS.w 1 ; Queue flags
recFlags DS.w 1 ; Not used. Set to zero
recProc DS.1 1 ; Pointer to the receive procedure
recCmdBase DS.w 1 ; First command received by this
procedure
recCmdCount DS.w 1 ; Number of commands allocated
for this procedure
recUserData DS.1 1 ; For caller’s use
recVXD ; For use by Apple PC VxD
MsgRecElemSize Equ *
ENDR