Message Queuing Functions


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.


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


Message Queuing functions include the following functions.

Function Description
MQADsPathToFormatName Translates the ADs path of a queue, queue alias, or distribution list into a format name.
MQBeginTransaction Creates an internal Message Queuing transaction object that can be used to send messages to a queue or read messages from a queue.
MQCloseCursor Closes a given cursor, allowing Message Queuing to release the associated resources.
MQCloseQueue Closes a given queue.
MQCreateCursor Creates a cursor for a specific queue and returns its handle.
MQCreateQueue Creates a public or private queue.
MQDeleteQueue Deletes a queue from the directory service or from the local computer.
MQFreeMemory Frees memory allocated by Message Queuing.
MQFreeSecurityContext Frees the memory allocated by MQGetSecurityContext.
MQGetMachineProperties Retrieves information about a queue manager computer.
MQGetOverlappedResult Retrieves the Message Queuing receive success or error code from the OVERLAPPED structure used to retrieve a message asynchronously.
MQGetPrivateComputerInformation Retrieves information about the local computer without accessing the directory service.
MQGetQueueProperties Retrieves the specified set of properties for a specific queue.
MQGetQueueSecurity Retrieves 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.
MQHandleToFormatName Returns a format name for the queue based on its handle.
MQInstanceToFormatName Returns a format name for the queue based on the identifier provided.
MQLocateBegin Starts a query to locate a public queue, returning a query handle.
MQLocateEnd Ends a query, releasing the resources associated with the query.
MQLocateNext Retrieves 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.
MQOpenQueue Opens a queue for sending, peeking at, retrieving, or purging messages.
MQPathNameToFormatName Returns 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.
MQReceiveMessage Allows 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.
MQSendMessage Sends a message to the queue corresponding to the handle hDestinationQueue.
MQSetQueueProperties Sets the properties of a specific queue.
MQSetQueueSecurity Sets the access control security descriptor of a queue.
MQMoveMessage Moves messages between a queue and its subqueue, or between two subqueues within the same main queue.
MQMarkMessageRejected Marks a message in a queue as rejected.


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.

See Also

Message Queuing Reference