WinQuerySendMsg returns the first message sent from any window on a specified thread to any window on another specified thread, but has not yet been processed by the receiving window.
#define INCL_WINMESSAGEMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>
HAB hab; /* Anchor-block handle of the caller. */
HMQ hmqSender; /* Message-queue handle of the sender. */
HMQ hmqReceiver; /* Message-queue handle of the receiver. */
PQMSG pQmsg; /* Pointer to the message structure. */
HMQ hmq; /* Queue handle of the sender. */
hmq = WinQuerySendMsg(hab, hmqSender, hmqReceiver,
pQmsg);