Its working. Thanks !!!!

-----Original Message-----
From: Willy Denoyette [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 13, 2004 8:18 PM
To: S, Saravana
Subject: RE: MSMQ


MSQM exposes the number of messages and byte count through perf. Counter
values.
Reading them using System.Management and WMI class
Win32_PerfFormattedData_MSMQ_MSMQQueue is just a snap.


using System;
using System.Management;
// get MSMQ counter values
class App {
        public static void Main() {
// get no. of messages in private queue testqueu
        
GetMsgInQueue("Win32_PerfFormattedData_MSMQ_MSMQQueue.Name='machine\\pri
vate
$\\testqueue'");
        }

        static void GetMsgInQueue (string objectClass) {
                ManagementObject mq;
                using(mq = new ManagementObject (objectClass))
                {
                        mq.Get();
                        Console.WriteLine("[{0}] Messages in queue:
{1}",mq.Properties["MessagesinQueue"].Value,
                                mq.Properties["Name"].Value);
                }
        }
}

Willy.

-----Original Message-----
From: Saravana Prasad S [mailto:[EMAIL PROTECTED]
Sent: woensdag 12 mei 2004 6:54
Subject: MSMQ

Hi All,

        Is there anyway one can programatically know the number of
messages in a queue. I couldn't figure out any in System.Messaging
namespace.

Thanks & Regards,
-------------------------------------------------------
Saravana Prasad S
Software Engineer -Dell | Aries

 <<Picture (Metafile)>>
DELL, Global Development Center, India
Work: +91(80) 8419110/112 Ext: 77431
           Austin Ext: 78449
-------------------------------------------------------



===================================
This list is hosted by DevelopMentorR  http://www.develop.com Some .NET
courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to