Hi all,
Iam using MSMQ in Windows Mobile 5.0 Mobile Application is sending the Messages(MSMQ) to the server. At some point i want to check whether any pending message is in the Queue. I tried to Access it using the following but its not returing any pending messages. I tried the same code in a windows application and its displaying the messages pending. can anyone pl tell me whether there is any error in my code.
// open the message queue
MessageQueue MQueue = new MessageQueue(QueueName);
//Initialize the MessageQueue Formatter so that the objects can serialized System.Type[] types = new Type[1]; types[0] = typeof(ReceiptMsmq);
MQueue.Formatter = new XmlMessageFormatter(types); try { TreeView1.Nodes.Clear(); TreeView1.BeginUpdate();
MessageQueue[] allprivatequeus = MessageQueue.GetPrivateQueuesByMachine("."); foreach(MessageQueue queue in allprivatequeus) { TreeNode qNode = new TreeNode(); qNode.Text = queue.QueueName; qNode.Tag = "Queue"; TreeView1.Nodes.Add(qNode);
foreach (Message m in queue) { TreeNode mNode = new TreeNode(); mNode.Tag = "Message"; mNode.Text = m.Label; TreeView1.Nodes[Array.IndexOf(allprivatequeus, queue)].Nodes.Add(mNode); } }
TreeView1.EndUpdate(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); }
// close the message queue MQueue.Close();
This is the code iam using right now. I just wanna display the pending messages in a tree. Pl. help me out in this issue
Thanks In Advance Kind Regards Biju S Melayil
.NET Development9
|