Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 系统锁定时,处理Windows弹出窗口,如“另存为”、“选择文件”、“直接UI HWND InternetExplorer下载条…”_C#_.net_C# 4.0_C# 3.0 - Fatal编程技术网

C# 系统锁定时,处理Windows弹出窗口,如“另存为”、“选择文件”、“直接UI HWND InternetExplorer下载条…”

C# 系统锁定时,处理Windows弹出窗口,如“另存为”、“选择文件”、“直接UI HWND InternetExplorer下载条…”,c#,.net,c#-4.0,c#-3.0,C#,.net,C# 4.0,C# 3.0,为了处理所有的弹出窗口,我采用了三种不同的方法,但是当系统被锁定时,它们都不起作用,请帮助我解决这个问题 在UIAutomationClient.dll、UIAutomationClientsideProviders.dll、UIAutomationProvider.dll、UIAutomationTypes.dll的帮助下 using System.Windows.Automation; AutomationElement ieElement = AutomationElement.From

为了处理所有的弹出窗口,我采用了三种不同的方法,但是当系统被锁定时,它们都不起作用,请帮助我解决这个问题

在UIAutomationClient.dll、UIAutomationClientsideProviders.dll、UIAutomationProvider.dll、UIAutomationTypes.dll的帮助下

using System.Windows.Automation;

AutomationElement ieElement = AutomationElement.FromHandle((IntPtr)ieObj.HWND);//Save As popup handle for Popups

            AutomationElement saveElement = ReturnRequiredElement(ieElement, "Save", "Name");
            if (saveElement.Current.Name.Equals("Save"))
            {
                var invokePattern = saveElement.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
                invokePattern.Invoke();
            }
借助输入模拟器

using WindowsInput;

InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.MENU, VirtualKeyCode.VK_S);
使用sendkey

SendKeys.SendWait("^+{S}");
您知道,在系统中运行调度程序或批处理自动化时,我们不能期望它始终处于活动状态,尤其是在服务器中


提前感谢

注意:当系统或桌面处于活动状态时,上述所有代码均可正常工作注意:当系统或桌面处于活动状态时,上述所有代码均可正常工作