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); }
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); }
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); }
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); }