How to get the List of Component Services using Dotnet ?

  • Thread starter Thread starter SenthilVel
  • Start date Start date
S

SenthilVel

Hi

I want to list the available "Component Services " (COM+) in a machine .

i am trying to get the list of Componenet services in a machine using
windows forms in dotnet , how can i retrive the list of componenet services,

i know we can get the list of windows services, but i dont know how to get
the list of Component services ?

can any one let me know how to do this ?

Thanks
Senthil
 
Hi,

Add COM reference to C:\Windows\System32\comsvcs.dll
Then enumerate COM+ applications as following:
-- BEGIN CODE --

COMSVCSLib.MtsGrpClass group = new COMSVCSLib.MtsGrpClass();

for (int i = 0; i < group.Count; i++)
{
object item = null;
group.Item(i, out item);
COMSVCSLib.COMEvents events = (COMSVCSLib.COMEvents) item;

listBox1.Items.Add(events.GetProcessID().ToString() + ":" +
events.PackageGuid + ":" + events.PackageName);
Marshal.ReleaseComObject(item);
item = null;
Marshal.ReleaseComObject(events);
events = null;
}

Marshal.ReleaseComObject(group);
group = null;
-- END CODE --

hope this helps
 
Hi

Thanks a Lot !!!

i have one more requirement:

i need to select the listed COM+ Applications and be bale to start and
Stop...

for windows service i used to do like this:
ServiceController SC = new ServiceController();

SC.ServiceName = "MyService";

SC.start();

so in the same way what must be done here for COM+ ?

Thanks

Senthil
 
Back
Top