This example creates a message queue of default size.

#define INCL_WINMESSAGEMGR        /* Window Message functions  */
#define INCL_WINWINDOWMGR         /* Window Manager functions  */
#include <os2.h>

HAB     hab;                      /* Anchor-block handle       */
HMQ     hmq;                      /* Message queue handle      */
QMSG    qmsg;                     /* Message                   */

hab = WinInitialize(0);           /* Initialize PM             */

hmq = WinCreateMsgQueue(hab, 0);  /* Create default size queue */

   .
   .   /* Initialize the windows */
   .

/* Get and dispatch the messages from the queue */
while (WinGetMsg(hab, &qmsg, 0, 0, 0))
      WinDispatchMsg(hab, &qmsg);


[Back] [Next]