Send C++ Structure to MSMQ Message
- by Gobalakrishnan
Hi, I am trying to send the below structure through
MSMQ Message
typedef struct
{
char cfiller[7];
short MsgCode;
char cfiller1[11];
short MsgLength;
char cfiller2[2];
} MESSAGECODE;
typedef struct
{
MESSAGECODE Header;
char DealerId[16];
char GroupId[16];
long Token;
short Periodicity;
double Deposit;
double GrossExposureLimit;
double NetExposureLimit;
double NetSaleExposureLimit;
double NetPositionLimit;
double TurnoverLimit;
double PendingOrdersLimit;
double MTMLossLimit;
double MaxSingleTransValue;
long MaxSingleTransQty;
double IMLimit;
long NetQuantityLimit;
} LIMITUPDATE;
void main()
{
//
// create queue
// open queue
// send message
//
OleInitialize(NULL); // have to init OLE
//
// declare some variables
//
IMSMQQueueInfoPtr qinfo("MSMQ.MSMQQueueInfo");
IMSMQQueuePtr qSend;
IMSMQMessagePtr m("MSMQ.MSMQMessage");
LIMITUPDATE l1;
l1.Header.MsgCode=26001;
l1.Header.MsgLength=150;
qinfo->PathName = ".\\private$\\q99";
m->Body = l1;
qSend = qinfo->Open(MQ_SEND_ACCESS, MQ_DENY_NONE);
m->Send(qSend);
qSend->Close();
}
while compiling i am getting the following error.
Error 2 error C2664:
'IMSMQMessage::PutBody' : cannot
convert parameter 1 from 'LIMITUPDATE'
to 'const _variant_t
&' c:\temp\msmq\msmq.cpp 58 msmq
thank you.