Common Desktop Environment: ToolTalk Messaging Overview

Example Ttmedia_load_msg_cb

Example D-3 is an example of a typical algorithm of this callback.


Example D-3 Typical Algorithm of Ttmedia_load_msg_cb

Tt_message 
myLoadMsgCB(
    Tt_messagemsg,
    void       *clientData,
    Tttk_op         op,
    unsigned char  *contents,
    int    len,
    char           *file
)
{
    if (len > 0) {
        // Replace data with len bytes in contents
    } else if (file != 0) {
        // Replace data with data read from file
    }
    if (op == TTME_DEPOSIT) {
        tt_message_reply( msg );
    }
    tttk_message_destroy( msg );
    return 0; 
}