This example retrieves the process identity from a queue by passing the queue handle to WinQueryQueueInfo.
#define INCL_WINMESSAGEMGR #include <OS2.H> HMQ hmq; MQINFO mqinfo; PID pid; WinQueryQueueInfo(hmq, &mqinfo, sizeof(MQINFO)); pid = mqinfo.pid;