Exemple #1
0
        /// <summary>
        ///     Starts PowerPoint
        /// </summary>
        private void StartPowerPoint()
        {
            if (IsPowerPointRunning)
            {
                Logger.WriteToLog($"Powerpoint is already running on PID {_powerPointProcess.Id}... skipped");
                return;
            }

            Logger.WriteToLog("Starting PowerPoint");

            _powerPoint = new PowerPointInterop.ApplicationClass
            {
                DisplayAlerts = PowerPointInterop.PpAlertLevel.ppAlertsNone,
                DisplayDocumentInformationPanel = false,
                AutomationSecurity = MsoAutomationSecurity.msoAutomationSecurityForceDisable
            };

            ProcessHelpers.GetWindowThreadProcessId(_powerPoint.HWND, out var processId);
            _powerPointProcess = Process.GetProcessById(processId);

            Logger.WriteToLog($"PowerPoint started with process id {_powerPointProcess.Id}");
        }