Interprocess Communication Using Atoms (Part 1)

CASE WMP_SENDREQUEST:
     hSysAtomTable = WinQuerySystemAtomTable(); /* Get atom table handle */
     ReqAtom = WinAddAtom(hSysAtomTable,        /* Add string to table   */
                          szRequest);           /* String to be added    */
     WinPostMsg(hServer,                        /* Post msg to server    */
                WMP_DOREQUEST,                  /* DO_REQUEST message    */
                (MPARAM)ReqAtom,                /* Atom to access string */
                (MPARAM)hWnd);                  /* Return window handle  */

     <Store ReqAtom in window words>

     return((MRESULT)0);                        /* Return zero           */
     break;
       :
       :
case WMP_REQUESTCOMPLETE:
     hSysAtomTable = WinQuerySystemAtomTable(); /* Get atom table handle */
     ReplyAtom = (ATOM)mp1;                     /* Get atom for reply    */
     WinQueryAtomName(hSysAtomTable,            /* Get string from atom  */
                      ReplyAtom,                /* Atom                  */
                      szReply,                  /* Buffer for string     */
                      sizeof(szReply));         /* Size of buffer        */

     <Verify reply is correct>

     WinDeleteAtom(hSysAtomTable,               /* Delete atoms          */
                   ReqAtom);
     WinDeleteAtom(hSysAtomTable,
                   ReplyAtom);
     return(TRUE);
     break;

This example shows a "requester" window procedure issuing requests and receiving replies by way of Presentation Manager messages.


[Back: Interprocess Communication Using Shared Memory (Part 2)]
[Next: Interprocess Communication Using Atoms (Part 2)]