Message Queuing Functions


Updated: July 19, 2016

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The Message Queuing functions enable you to manage queues and messages within your Message Queuing application. The Message Queuing API includes functions for creating, opening, and deleting queues; for locating existing queues and messages in queues; for sending messages and reading them in queues; and for setting and retrieving properties.

System_CAPS_ICON_note.jpg Note

All strings passed to or returned by Message Queuing functions are in Unicode format (2-byte characters).

Message Queuing functions include the following functions.

MQADsPathToFormatNameTranslates the ADs path of a queue, queue alias, or distribution list into a format name.
MQBeginTransactionCreates an internal Message Queuing transaction object that can be used to send messages to a queue or read messages from a queue.
MQCloseCursorCloses a given cursor, allowing Message Queuing to release the associated resources.
MQCloseQueueCloses a given queue.
MQCreateCursorCreates a cursor for a specific queue and returns its handle.
MQCreateQueueCreates a public or private queue.
MQDeleteQueueDeletes a queue from the directory service or from the local computer.
MQFreeMemoryFrees memory allocated by Message Queuing.
MQFreeSecurityContextFrees the memory allocated by MQGetSecurityContext.
MQGetMachinePropertiesRetrieves information about a queue manager computer.
MQGetOverlappedResultRetrieves the Message Queuing receive success or error code from the OVERLAPPED structure used to retrieve a message asynchronously.
MQGetPrivateComputerInformationRetrieves information about the local computer without accessing the directory service.
MQGetQueuePropertiesRetrieves the specified set of properties for a specific queue.
MQGetQueueSecurityRetrieves information from the access control security descriptor of the specified queue.
MQGetSecurityContext(Superseded by MQGetSecurityContextEx.) Retrieves security information needed to attach a certificate to a message for authentication.
MQGetSecurityContextEx(Introduced in Windows® 2000 Service Pack 2, supersedes MQGetSecurityContext.) Retrieves the security information needed to attach a certificate to a message for authentication.
MQHandleToFormatNameReturns a format name for the queue based on its handle.
MQInstanceToFormatNameReturns a format name for the queue based on the identifier provided.
MQLocateBeginStarts a query to locate a public queue, returning a query handle.
MQLocateEndEnds a query, releasing the resources associated with the query.
MQLocateNextRetrieves the requested queue information from the query.
MQMgmtAction(Introduced in MSMQ 3.0.) Changes the state of a computer or a queue.
MQMgmtGetInfo(Introduced in MSMQ 3.0.) Retrieves information about a computer or a queue.
MQOpenQueueOpens a queue for sending, peeking at, retrieving, or purging messages.
MQPathNameToFormatNameReturns a format name based on the Message Queuing path name provided.
MQPurgeQueue(Introduced in MSMQ 3.0.) Deletes all of the messages in a queue.
MQReceiveMessageAllows you to read messages in the queue.
MQReceiveMessageByLookupId(Introduced in MSMQ 3.0.) Peeks at or retrieves messages in the queue based on message lookup identifiers.
MQSendMessageSends a message to the queue corresponding to the handle hDestinationQueue.
MQSetQueuePropertiesSets the properties of a specific queue.
MQSetQueueSecuritySets the access control security descriptor of a queue.
MQMoveMessageMoves messages between a queue and its subqueue, or between two subqueues within the same main queue.
MQMarkMessageRejectedMarks a message in a queue as rejected.
System_CAPS_ICON_note.jpg Note

The functionality of the local administration API functions introduced in MSMQ 3.0 (MQMgmtAction, MQMgmtGetInfo, and MQPurgeQueue) is also available for computers running previous versions of Message Queuing. For more information, see MSMQ Local Admin API.

Message Queuing Reference

Community Additions