Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function writes a single message to a message queue.
Syntax
BOOL WriteMsgQueue( HANDLE hMsgQ, LPVOID lpBuffer, DWORD cbDataSize, DWORD dwTimeout, DWORD dwFlags ); |
Parameters
- hMsgQ
-
[in] Handle to an open message queue.
- lpBuffer
-
[in] Pointer to a buffer that contains data to write to a message queue. This parameter cannot be NULL.
- dwTimeout
-
[in] Amount of time, in milliseconds, before the write operation times out. If zero is specified, the write operation does not block when the write operation cannot be performed. If you set the parameter to INFINITE, the write operation blocks until the write operation succeeds or the queue status changed.
- cbDataSize
-
[in] Number of bytes stored in lpBufferthat comprise a message. This parameter cannot be zero.
- dwFlags
-
[in] DWORDvalue to indicate the properties of the message.
Set this parameter to MSGQUEUE_MSGALERT to specify that the message is an alert message. There can be only one outstanding alert message in the queue, so this value is treated as a hint. If there is already an alert message in the queue, this flag is ignored, and the message is added to the queue as a normal message at the end of the queue.
This parameter can be set to zero or NULL.
Return Value
TRUE indicates success. FALSE indicates failure. To obtain extended error information, call GetLastError. The following table shows possible values returned by GetLastError.
Value | Description | ||
---|---|---|---|
ERROR_INSUFFICIENT_BUFFER |
The size of lpBufferwas too small to hold a message. |
||
ERROR_OUTOFMEMORY |
MSGQUEUE_NOPRECOMMIT was specified, and there was not enough memory to allocate for the message. |
||
ERROR_PIPE_NOT_CONNECTED |
Indicates that there are no readers attached to the message queue. If all of the readers exit while the writer is blocked and you did not specify MSGQUEUE_ALLOW_BROKEN, the write operation fails, and GetLastErrorreturns this value.
|
||
ERROR_TIMEOUT |
The write operation timed out before it could write its data. |
Requirements
Header | msgqueue.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE .NET 4.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |