共用方式為


PROPID_M_SRC_MACHINE_ID

 

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

(Read-only.) The PROPID_M_SRC_MACHINE_ID property provides the identifier of the computer that sent the message.

Property ID

PROPID_M_SRC_MACHINE_ID

Type Indicator

VT_CLSID

MQPROPVARIANT Field

puuid

Property Value

Globally unique identifier (GUID) of the source computer.

Remarks

The PROPID_M_SRC_MACHINE_ID property is used only by the receiving application when calling MQReceiveMessage or MQReceiveMessageByLookupId.

This property returns the GUID of the computer without the enclosing braces.

To retrieve the identifier of the source computer, include PROPID_M_SRC_MACHINE_ID in the MQMSGPROPS structure, then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned value.

Equivalent COM Property

With COM components, the equivalent property is MSMQMessage.SourceMachineGuid.

Example Code

The following code fragment shows PROPID_M_SRC_MACHINE_ID is specified in arrays that can be used to initialize an MQMSGPROPS structure for retrieving the GUID of the computer that sent the message.

CLSID guidBuffer = 0;  
aMsgPropId[i] = PROPID_M_SRC_MACHINE_ID;       // Property ID  
aMsgPropVar[i].vt = VT_CLSID;                  // Type indicator  
aMsgPropVar[i].puuid = &guidBuffer;  
i++;  

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
MSMQMessage.SourceMachineGuid