はじめまして。質問させてください。
現在Win2000でMSMQで送受信処理をしています。MQMSGPROPS構造体でPROPID_M_LABELを使用していたのですが、PROPID_M_LABELだとデータ領域が足らずPROPID_M_BODYに変更をしています。変更後送受信はうまくいっているようですが、送信したデータが正常に受信できません。
どなたかやり方等をご教授ください。宜しくお願いします。
送信ソース
const int NUMBEROFPROPERTIES = 5;
DWORD cPropId = 0;
HRESULT hr;
HANDLE hQueue;
int i = 0;
MQMSGPROPS msgProps;
memset( &msgProps, 0x00, sizeof(msgProps));
MSGPROPID aMsgPropId[NUMBEROFPROPERTIES];
MQPROPVARIANT aMsgPropVar[NUMBEROFPROPERTIES];
HRESULT aMsgStatus[NUMBEROFPROPERTIES];
/*--------------------------*/
/* MQMSGPROPS構造体を初期化 */
/*--------------------------*/
msgProps.cProp = cPropId;
msgProps.aPropID = aMsgPropId;
msgProps.aPropVar = aMsgPropVar;
msgProps.aStatus = aMsgStatus;
WCHAR wszMessageBody[] = L"Test Message.";
msgProps.aPropID[i] = PROPID_M_BODY;
msgProps.aPropVar[i].vt = VT_VECTOR|VT_UI1; msgProps.aPropVar[i].caub.pElems = (LPBYTE)wszMessageBody;
msgProps.aPropVar[i].caub.cElems = sizeof(wszMessageBody);
i++;
DWORD dwBodyType = VT_BSTR;
msgProps.aPropID[i] = PROPID_M_BODY_TYPE;
msgProps.aPropVar[i].vt = VT_UI4;
msgProps.aPropVar[i].ulVal = dwBodyType;
i++;
//キューオープン処理
//キュー送信処理
//MQSendMessageを使用
受信ソース
const int NUMBEROFPROPERTIES = 5;
// const int LABELSIZE = 250;
DWORD cPropId = 0;
HRESULT hr;
HANDLE hQueue;
// WCHAR wszLabelBuffer[LABELSIZE];
int i = 0;
/*--------------------------*/
/* キュープロパティ格納処理 */
/*--------------------------*/
MSGPROPID aMsgPropId[NUMBEROFPROPERTIES];
MQPROPVARIANT aMsgPropVar[NUMBEROFPROPERTIES];
HRESULT aMsgStatus[NUMBEROFPROPERTIES];
/*--------------------------*/
/* MQMSGPROPS構造体を初期化 */
/*--------------------------*/
MQMSGPROPS msgProps;
msgProps.cProp = cPropId;
msgProps.aPropID = aMsgPropId;
msgProps.aPropVar = aMsgPropVar;
msgProps.aStatus = aMsgStatus;
msgProps.aPropID[i] = PROPID_M_BODY_SIZE;
msgProps.aPropVar[i].vt = VT_UI4;
i++;
msgProps.aPropID[i] = PROPID_M_BODY_TYPE;
msgProps.aPropVar[i].vt = VT_UI4;
i++;
DWORD dwBodyBufferSize = 1024;
UCHAR *pucBodyBuffer = (UCHAR *)malloc(dwBodyBufferSize);
memset(pucBodyBuffer,0x00,sizeof(pucBodyBuffer));
msgProps.aPropID[i] = PROPID_M_BODY;
msgProps.aPropVar[i].vt = VT_VECTOR|VT_UI1;
msgProps.aPropVar[i].caub.pElems = (UCHAR*)pucBodyBuffer;
msgProps.aPropVar[i].caub.cElems = dwBodyBufferSize;
i++;
//構造体を利用して受信処理
//MQReceiveMessageを使用
ツイート | ![]() |