This example uses WinGetMsg to continually loop and retrieve messages from the message queue until a WM_QUIT message occurs.

#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                 */
PQMSG   pqmsgmsg;       /* message                              */

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

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

/*
.
.  initialize windows
.
*/

/* get and dispatch messages from queue */
while (WinGetMsg(hab, &qmsgmsg, 0, 0, 0))
   WinDispatchMsg(hab, &qmsgmsg);


[Back] [Next]