Чтение сообщения из очереди.
BOOL CMQMsgDlg::LoadMessages
  (LPCTSTR szQueueName)
{
.............................
	if( OpenQueue( szQueueName,&hQueue,MQ_PEEK_ACCESS | MQ_RECEIVE_ACCESS ) )
	{
		if( MQCreateCursor( hQueue,&hCursor ) == MQ_OK )
		{
			do
			{
				bIsRead = FALSE;
				mqMessageProps.cProp = 4;
				mqMessageProps.aPropID = aPropID;
				mqMessageProps.aPropVar = aPropVar;
				mqMessageProps.aStatus = aStatus;
				aPropID[0] = PROPID_M_BODY_SIZE;
				aPropVar[0].vt = VT_UI4;
				aStatus[0] = 0;
				aPropID[1] = PROPID_M_SENDERID_LEN;
				aPropVar[1].vt = VT_UI4;
				aStatus[1] = 0;
				aPropID[2] = PROPID_M_SRC_MACHINE_ID;
				aPropVar[2].vt = VT_CLSID;
				aStatus[2] = 0;
				aPropVar[2].puuid = &guidSourceComputer;
				aPropID[3] = PROPID_M_BODY_TYPE;
				aPropVar[3].vt = VT_UI4;
				aStatus[3] = 0;
				if( ( (hRet = MQReceiveMessage( hQueue,DEFAULT_TIMEOUT,dwReceive
Action,&mqMessageProps,NULL,NULL,hCursor,NULL )) == MQ_OK ) && 
 aPropVar[0].ulVal > 0 ) && ( aPropVar[1].ulVal > 0 ) )
				{
					if( (hRet = MQReceiveMessage( hQueue,DEFAUKT_TIMEOUT,MQ_AC-TION_PEEK_CURRENT,&mqMessageProps,NULL,NULL,hCursor,NULL )) == MQ_OK ) 
					{
					}
					delete lpMsg;
					delete lpSID;
				}
			} while( bIsRead );
			MQCloseCursor( hCursor );
		}
		MQCloseQueue( hQueue ); 
	}
	return bRet;
}