這是一個結構體類型變數,定義在winbase.h
定義,性質,套用,
定義
該結構體定義如下:
typedef struct MSGQUEUEOPTIONS_OS {
DWORD dwSize; // size of the structure
DWORD dwFlags; // behavior of message queue
DWORD dwMaxMessages; // max # of msgs in queue
DWORD cbMaxMessage; // max size of msg
BOOL bReadAccess; // read access requested
} MSGQUEUEOPTIONS, FAR *LPMSGQUEUEOPTIONS, *PMSGQUEUEOPTIONS;
DWORD dwSize; // size of the structure
DWORD dwFlags; // behavior of message queue
DWORD dwMaxMessages; // max # of msgs in queue
DWORD cbMaxMessage; // max size of msg
BOOL bReadAccess; // read access requested
} MSGQUEUEOPTIONS, FAR *LPMSGQUEUEOPTIONS, *PMSGQUEUEOPTIONS;
性質
在串口通信中,常用於創建訊息佇列的第二個參數CreateMsgQueue(LPCWSTR lpName, LPMSGQUEUEOPTIONS lpOptions);
套用
例:
MSGQUEUEOPTIONS m_msgQOpt;
m_msgQOpt.dwSize = sizeof(m_msgQOpt);
m_msgQOpt.dwFlags = MSGQUEUE_ALLOW_BROKEN|MSGQUEUE_NOPRECOMMIT;
m_msgQOpt.dwMaxMessages = 0;
m_msgQOpt.cbMaxMessage = 150;
m_msgQOpt.bReadAccess = TRUE;//預示著將創建一個讀訊息佇列,FALSE為寫訊息佇列
m_hMsgInQueue = ::CreateMsgQueue(g_szServerInQName, &m_msgQOpt); // 創建訊息佇列
m_msgQOpt.dwFlags = MSGQUEUE_ALLOW_BROKEN|MSGQUEUE_NOPRECOMMIT;
m_msgQOpt.dwMaxMessages = 0;
m_msgQOpt.cbMaxMessage = 150;
m_msgQOpt.bReadAccess = TRUE;//預示著將創建一個讀訊息佇列,FALSE為寫訊息佇列
m_hMsgInQueue = ::CreateMsgQueue(g_szServerInQName, &m_msgQOpt); // 創建訊息佇列