private static Word.Application GetActiveWordApp(COMObjectsHelper comHelper) { var wordApplications = COMObjectsHelper.GetActiveInteropApp <Word.Application>(comHelper, MSWORD_INTEROP_APP_NAME) ?? throw new InvalidInteropOperationException($"Could not find any {MSWORD_INTEROP_APP_NAME} application."); return(wordApplications.Find(app => comHelper.Register(() => app?.ActiveWindow) != null)); }
private static PowerPoint.Application GetActivePowerPointApp(COMObjectsHelper comHelper) { var ppApplications = COMObjectsHelper.GetActiveInteropApp <PowerPoint.Application>(comHelper, MSPOWERPOINT_INTEROP_APP_NAME) ?? throw new InvalidInteropOperationException($"Could not find any {MSPOWERPOINT_INTEROP_APP_NAME} application."); return(ppApplications.Find(app => comHelper.Register(() => app.ActiveWindow) != null)); }