Determining if a COM+ application is running.
I needed to know if one of my COM+ applications was currently running. Some Googling came up with an "ApplicationInstances" collection by interop'ing with the COMAdmin library, but that only works for XP and Win2K3 Server. Of course, I needed this for Win2k.
Some more Googling returned information on the IMtsGrp interface in the COMSvcs library. This works from NT4 through to XP and was just what I needed. I generated a RCW for it and coded my function:
private bool IsRunning(string applicationName) { IMtsGrp group = new MtsGrpClass(); for(int i=0; i<group.Count ; i++ ) { object outEvents; group.Item(i, out outEvents); COMEvents eventObj = (COMEvents) outEvents; if( eventObj.PackageName == applicationName ) return true; } return false; }