This example shows how to get the handle of the message queue of a window.
#define INCL_WINWINDOWMGR #include <OS2.H> HWND hwnd; HMQ hmq; hmq = (HMQ)WinQueryWindowULong(hwnd, QWL_HMQ);