Share via


MQMgmtAction

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function changes the state of a computer or queue.

Syntax

HRESULT MQMgmtAction(
  LPCWSTR pMachineName, 
  LPCWSTR pObjectName, 
  LPCWSTR pAction 
);

Parameters

  • pMachineName
    [in] Pointer to a Unicode string that contains the name of the computer where the action will take place. Must be set to NULL in the embedded version of MSMQ.
  • pObjectName
    [in] Pointer to a Unicode string that describes the type of object that will be worked on.

    The following values are possible.

    Value Description

    L"MACHINE"

    Required when reading properties of the queue manager.

    L"QUEUE=<formatname>"

    Required to act on a specific queue on the computer.

  • pAction
    [in] Pointer to a string that indicates the action to be performed on the computer.

    The following values are defined in the Mqmgmt.h file.

    Value Description

    MACHINE_ACTION_CONSOLE

    Brings up the MSMQ console (debug version).

    MACHINE_ACTION_CONNECT

    Connects the computer to the network and to the directory service.

    MACHINE_ACTION_DISCONNECT

    Disconnects the computer from the network and from the directory service.

    MACHINE_ACTION_EXIT

    Exits manual mode.

    MACHINE_ACTION_SHUTDOWN

    Stops the MSMQ service.

    MACHINE_ACTION_STARTUP

    Starts the MSMQ service.

    MACHINE_ACTION_TIDY

    Cleans up empty message files every six hours.

    This is helpful when many messages are deleted (purged or received by an application) and the application needs the disk space available immediately.

    QUEUE_ACTION_DELMSG

    Deletes a message in the queue.

    QUEUE_ACTION_EOD_RESEND

    Resends the pending transaction sequence.

    QUEUE_ACTION_PAUSE

    Valid for outgoing queues only.

    Stops the sending of messages from the computer.

    The queue manager will not send messages to the applicable destination queue until a RESUME action is initiated.

    QUEUE_ACTION_PURGE

    Purges the queue (deletes all messages in the queue).

    Use MQMgmtAction with this option.

    MSMQ does not support a separate MQPurgeQueue function like the desktop version of MSMQ.

    QUEUE_ACTION_RESUME

    Only valid for outgoing queues.

    Restarts the sending of messages after a PAUSE action has been initiated.

Return Value

  • MQ_OK
    Indicates success.
  • MQ_ERROR_ACCESS_DENIED (0xC00E0025)
    The process does not have the access rights to perform management actions on the queue or computer.
  • MQ_ERROR_ILLEGAL_FORMATNAME (0xC00E001E)
    The specified format name in pObjectName is illegal.
  • MQ_ERROR_SERVICE_NOT_AVAILABLE (0xC00E000B)
    Cannot connect to the queue manager.

Requirements

Header mqmgmt.h
Library msmqrt.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later