Specifications

CHAPTER 4
Software Support
82 Messaging Code Samples
Supplementary Information 4
The value cmdCount is needed to register a message. It contains the number of different
types of messages an application would like to support. For example, if an application
wants to send two types of messages (“send DOS command” and “receive error code”)
between the Macintosh computer and the PC system, it would set this value to 2.
Installing Command Receiver 4
The following parameter block is used to install the command receiver:
pRecElem–>recFlags = 0;
// Receive message proc.
pRecElem->recProc = (ProcPtr)RcvMsg;
pRecElem->recCmdBase = cmdBase;
pRecElem->recCmdCount = cmdCount;
// User-defined data
precElem->recUserData = nil;
pbp.csCode = rsInstallMsgHandler; = 801
pbp.csPtr = pRecElem;
err = PBControl ((ParmBlkPtr)&pbp);
Supplementary Information 4
Interpretation of messages is done by the RcvMsg procedure. As part of the application
that asks for a message block, it has to install a message receive procedure.
The result returned from registering a message is the base address of the messages that
your application will get back, cmdBase. If the application asks for 2 cmd and the base
address returned is C000, then all messages that have the address of C000 and C001
belong to that application and are interpreted however the application wishes to
interpret them.
The value cmdCount is needed to register a message. It contains the number of different
types of messages an application would like to support. For example, if an application
wants to send two types of messages (“send DOS command” and “receive error code”)
between the Macintosh computer and the PC system, it would set this value to 2.
Sending a Message to the PC System 4
The following code is used to pass a message to the PC system:
pMsg->msgCompletion = (ProcPtr)WrComp;
pMsg->msgUserData = nil;
pMsg->msgFlags = 0;
RSParamBlockRec Params;
pbp.ioCRefNum = gRSDrvrRefNum;