[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

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");