Three primary steps are required to open the clipboard device:
* Create a message port using createport(). reply messages from the
device must be directed to a message port.
* Create an extended I/O request structure of type ioclipreq using
createextio().
* Open the clipboard device. Call opendevice(), passing the ioclipreq.
struct MsgPort *ClipMP; /* pointer to message port*/
struct IOClipReq *ClipIO; /* pointer to IORequest */
if (ClipMP=CreatePort(0L,0L) )
{
if (ClipIO=(struct IOClipReq *)
CreateExtIO(ClipMP,sizeof(struct IOClipReq)))
{
if (OpenDevice("clipboard.device",0L,ClipIO,0))
printf("clipboard.device did not open\n");
else
{
... do device processing
}
{
else
printf("Error: Could not create IORequest\n");
}
else
printf("Error: Could not create message port\n");