GetRunningObjectTable() приватный Метод

private GetRunningObjectTable ( int reserved, IRunningObjectTable &prot ) : void
reserved int
prot IRunningObjectTable
Результат void
        // From http://www.viva64.com/en/b/0169/
        public static DTE2 GetById(int id)
        {
            //rot entry for visual studio running under current process.
            string rotEntry = string.Format(CultureInfo.InvariantCulture, "!VisualStudio.DTE.12.0:{0}", id);
            IRunningObjectTable rot;

            NativeMethods.GetRunningObjectTable(0, out rot);
            IEnumMoniker enumMoniker;

            rot.EnumRunning(out enumMoniker);
            enumMoniker.Reset();
            IntPtr fetched = IntPtr.Zero;

            IMoniker[] moniker = new IMoniker[1];
            while (enumMoniker.Next(1, moniker, fetched) == 0)
            {
                IBindCtx bindCtx;
                NativeMethods.CreateBindCtx(0, out bindCtx);
                string displayName;
                moniker[0].GetDisplayName(bindCtx, null, out displayName);
                if (displayName == rotEntry)
                {
                    object comObject;
                    var    result = rot.GetObject(moniker[0], out comObject);
                    Marshal.ThrowExceptionForHR(result);
                    return((DTE2)comObject);
                }
                else
                {
                    Source.TraceEvent(TraceEventType.Information, 0, "Found event with name: {0}", displayName);
                }
            }
            return(null);
        }