Interprocess Communication Using Atoms (Part 2)

CASE WMP_DOREQUEST:
     hAtomTable = WinQuerySystemAtomTable();    /* Get atom table handle */
     ReqAtom = (ATOM)mp1;                       /* Get atom for request  */
     hRequester = (HWND)mp2;                    /* Get requester handle  */

     ulLength = WinQueryAtomLength(hAtomTable,  /* Get size of string    */
                                   ReqAtom);
     szRequest = malloc(ulLength);              /* Allocate buffer       */

     WinQueryAtomName(hSysAtomTable,            /* Get string from atom  */
                      ReqAtom,                  /* Atom                  */
                      szRequest,                /* Buffer for string     */
                      sizeof(szRequest));       /* Size of buffer        */

     ServiceRequest(szRequest,szReply);         /* Complete request      */

     ReplyAtom = WinAddAtom(hSysAtomTable,      /* Add string to table   */
                            szReply);           /* String to be added    */

     WinPostMsg(hRequester,                     /* Post msg to requester */
                WMP_REQUESTCOMPLETE,            /* Message class         */
                (MPARAM)ReplyAtom,              /* Atom to access string */
                (MPARAM)0);                     /* Return window handle  */

     free(szRequest);                           /* Free request buffer   */
     return((MRESULT)0);                        /* Return zero           */
     break;

This example shows a "server" window procedure receiving and processing Presentation Manager messages.


[Back: Interprocess Communication Using Atoms (Part 1)]
[Next: Interprocess Communication Using Queues (Part 1)]