This function inspects the thread's message queue and returns to the application with or without a message.
#define INCL_WINMESSAGEMGR /* Or use INCL_WIN, INCL_PM, Also in COMMON section */ #include <os2.h> HAB hab; /* Anchor-block handle. */ PQMSG pqmsg; /* Message structure. */ HWND hwndFilter; /* Window filter. */ ULONG ulFirst; /* First message identity. */ ULONG ulLast; /* Last message identity. */ ULONG flOptions; /* Options. */ BOOL rc; /* Message-available indicator. */ rc = WinPeekMsg(hab, pqmsg, hwndFilter, ulFirst, ulLast, flOptions);