SetMessageQueue

2.x

  BOOL SetMessageQueue(cMsg)    
  int cMsg; /* size of message queue */

The SetMessageQueue function creates a new message queue. It is particularly useful in applications that require a queue that contains more than eight messages (the maximum size of the default queue).

Parameters

cMsg

Specifies the maximum number of messages that the new queue may contain. This value must not be larger than 120.

Return Value

The return value is nonzero if the function is successful. If the value specified in the cMsg parameter is larger than 120, the return value is nonzero but the message queue is not created. The return value is zero if an error occurs.

Comments

The function must be called from an application's WinMain function before any windows are created and before any messages are sent. The SetMessageQueue function destroys the old queue, along with messages it might contain.

If the return value is zero, the application has no queue, because the SetMessageQueue function deletes the original queue before attempting to create a new one. The application must continue calling SetMessageQueue with a smaller queue size until the function returns nonzero.

See Also

GetMessage, PeekMessage