コード例 #1
0
        public static IApplicationObject GetApplicationObject()
        {
            IApplicationObject app = null;

            IObjectContext obj;

            if (0 == NativeMethods.CoGetObjectContext(ref IID_IObjectContext, out obj))
            {
                IGetContextProperties prop = (IGetContextProperties)obj;
                if (prop != null)
                {
                    app = (IApplicationObject)prop.GetProperty("Application");
                    Marshal.ReleaseComObject(prop);
                }
                Marshal.ReleaseComObject(obj);
            }
            return(app);
        }
コード例 #2
0
        public static IRequest GetRequestObject()
        {
            IRequest request = null;

            IObjectContext obj;

            if (0 == NativeMethods.CoGetObjectContext(ref IID_IObjectContext, out obj))
            {
                IGetContextProperties prop = (IGetContextProperties)obj;
                if (prop != null)
                {
                    request = (IRequest)prop.GetProperty("Request");
                    Marshal.ReleaseComObject(prop);
                }
                Marshal.ReleaseComObject(obj);
            }
            return(request);
        }
コード例 #3
0
        public static ISessionObject GetSessionObject()
        {
            ISessionObject session = null;

            IObjectContext obj;

            if (0 == NativeMethods.CoGetObjectContext(ref IID_IObjectContext, out obj))
            {
                IGetContextProperties prop = (IGetContextProperties)obj;
                if (prop != null)
                {
                    session = (ISessionObject)prop.GetProperty("Session");
                    Marshal.ReleaseComObject(prop);
                }
                Marshal.ReleaseComObject(obj);
            }
            return(session);
        }
コード例 #4
0
        public static IResponse GetResponseObject()
        {
            IResponse Response = null;

            IObjectContext obj;

            if (0 == NativeMethods.CoGetObjectContext(ref IID_IObjectContext, out obj))
            {
                IGetContextProperties prop = (IGetContextProperties)obj;
                if (prop != null)
                {
                    Response = (IResponse)prop.GetProperty("Response");
                    Marshal.ReleaseComObject(prop);
                }
                Marshal.ReleaseComObject(obj);
            }

            return(Response);
        }