I'm new to VB6 and also MSMQ. I went through a lot of tutorials online but seems like there is no solution for my question.
I managed to sending from C# to C# or VB6 to VB6 but not from VB6 to C# or vice versa. So I wonder is it a way to do that or there is no way to do this kind of communication.
For example: I want to send this to MSMQ
Dim PropBag As PropertyBag
Set PropBag = New PropertyBag
PropBag.WriteProperty "Customer", "Bob"
PropBag.WriteProperty "Product", "MoeHairSuit"
PropBag.WriteProperty "Quantity", 4
and get the details in C#, there is "Invalid character in the given encoding. Line 1, position 1." error when I use XmlMessageFormatter
Message mes = mq.Receive(new TimeSpan(0, 0, 3));
mes.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
result = mes.Body.ToString();
I also tried to read from the stream but it come out with a weird symbol in my string. Below is the code and this is the output "늓\0\0\b\b휖ꭑ(\0customer\0Bob\0\b\a劑틠4\0product\v\0MoeHairSuit\b調⫳ᄂ.quantity\0"
Message mes;
mes = mq.Receive(new TimeSpan(0, 0, 3));
mes.BodyStream.Position = 0;
byte[] b = new byte[mes.BodyStream.Length];
mes.BodyStream.Read(b, 0, (int)mes.BodyStream.Length);
UnicodeEncoding uniCoder = new UnicodeEncoding();
result = uniCoder.GetString(b);
I get this exception "Cannot deserialize the message passed as an argument. Cannot recognize the serialization format." when using ActiveXMessageFormatter like below
mes = mq.Receive(new TimeSpan(0, 0, 3));
mes.Formatter = new ActiveXMessageFormatter();
result = mes.Body.ToString();
Do you guys have any idea how to do that? Thanks in advanced