Compartir a través de


PROPID_M_EXTENSION_LEN

 

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 PROPID_M_EXTENSION_LEN property specifies the length of the information in the PROPID_M_EXTENSION property.

Property ID

PROPID_M_EXTENSION_LEN

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

Property Value

The size (in bytes) of the extension information specified by PROPID_M_EXTENSION.

Remarks

PROPID_M_EXTENSION_LEN is used only by the receiving application. It is used whenever the receiving application specifies PROPID_M_EXTENSION in the MQMSGPROPS structure.

To retrieve extension information, set PROPID_M_EXTENSION and PROPID_M_EXTENSION_LEN in the MQMSGPROPS structure. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned values. When retrieving this property, the type indicator can be set to VT_UI4 or VT_NULL. If you set the type indicator to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.

When the function call succeeds, first test the returned value of PROPID_M_EXTENSION_LEN to see if any extension information exists. A returned value of 0 indicates that no information was sent by the sending application. A non-0 returned value indicates the extension information was returned by PROPID_M_EXTENSION.

If MQReceiveMessage or MQReceiveMessageByLookupId fails, returning an MQ_ERROR_BUFFER_OVERFLOW error, use the returned value of PROPID_M_EXTENSION_LEN to reallocate the extension information buffer and call the applicable function again.

Equivalent COM Property

This property is not needed when you are using COM components.

Example Code

The following code fragment shows how PROPID_M_EXTENSION_LEN and PROPID_M_EXTENSION are specified in arrays that can be used to initialize an MQMSGPROPS structure for retrieving extended information.

ULONG ulExtInfoBufferSize = 1024;  
UCHAR * pucExtInfoBuffer = NULL;  
pucExtInfoBuffer = (UCHAR*)malloc(ulExtInfoBufferSize);  
if (pucExtInfoBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(pucExtInfoBuffer, 0, ulExtInfoBufferSize);  
aMsgPropId[i] = PROPID_M_EXTENSION_LEN;     // Property ID  
aMsgPropVar[i].vt = VT_NULL;                // Type indicator  
i++;  
  
aMsgPropId[i] = PROPID_M_EXTENSION;         // Property ID  
aMsgPropVar[i].vt = VT_VECTOR | VT_UI1;     // Type indicator  
aMsgPropVar[i].caub.pElems = (UCHAR*)pucExtInfoBuffer;  
aMsgPropVar[i].caub.cElems = ulExtInfoBufferSize;  
i++;  

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
PROPID_M_EXTENSION