Has already written code:
HANDLE HMSGQ;
MSGQUEUEOPTIONS mqo.
Mqo. BReadAccess=FALSE;
Mqo. CbMaxMessage=32;
Mqo. DwFlags=MSGQUEUE_ALLOW_BROKEN;
Mqo. DwMaxMessages=3;//the message queue capacity 3
Mqo. DwSize=sizeof (MSGQUEUEOPTIONS);
TCHAR * writebuf=new TCHAR [32].
HMSGQ=CreateMsgQueue (L "MsgQueue", & amp; Mqo);//create a new message queue or according to the name to open the message queue
//write message
BOOL val=WriteMsgQueue (HMSGQ writebuf, 32, INFINITE, 0).//write messages into the queue
Q: at this point, how do I know if the queue is full, or know that there are few messages in the queue?
Use the GetMsgQueueinfo () can be implemented? Request a great god can give routines ~
CodePudding user response:
In general, there are many ways of judgment, XX is full1, counter - statistics of data in the queue, enter + 1, pop-up - 1
2, traverse the queue, if (leng=maxlen) full
3, write data failure
4...
5...
CodePudding user response:
Traverse the queue, if (leng=maxlen) full, unable to send