A property structure often contains three types of properties: IN properties, OUT properties, and IN/OUT properties.
Properties appear in no particular order in the aPropVar array. To determine the type of a property, MSMQ examines the property identifier and the function called. For example, for API functions, the queue quota property (PROPID_Q_QUOTA) is an OUT property when MQGetQueueProperties is called and an IN property when MQSetQueueProperties is called.
IN properties can be set to any valid setting for the specific property. However, VT_NULL cannot be used as an IN property VARTYPE value.
OUT properties returned by MSMQ require a PROPVARIANT entry where the returned value can be stored. For example, space must be allocated before the label of a queue or the body of a message can be specified. There are two ways for the application to specify such a PROPVARIANT entry:
For example, if myQueueProps is defined as an MQQUEUEPROPS structure to be passed to MQGetQueueProperties: Assign myQueueProps.aPropID[j]=PROPID_Q_LABEL and myQueueProps.aPropVar[j].vt=VT_NULL. When the call returns, myQueueProps.aPropVar[j]. pwszVal points to the buffer that was allocated by MSMQ that contains the queue label.
For Queue and Queue Manager properties whose field type is VT_LPWSTR, VARTYPE must be set to VT_NULL.
In all cases where MSMQ allocates a buffer for the MSMQ application, it is the application's responsibility to free the memory with the MQFreeMemory function.