zoukankan      html  css  js  c++  java
  • C# 重置IE安全等级

    打开IE设置-安全

     1     dynamic shellObject = Interaction.CreateObject("WScript.Shell", "");
     2     //打开IE设置-安全
     3     shellObject.Run("Rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,1");
     4     await Task.Delay(500);
     5     //默认级别
     6     shellObject.SendKeys("{TAB}");
     7     shellObject.SendKeys("{TAB}");
     8     shellObject.SendKeys("{TAB}");
     9     shellObject.SendKeys("{TAB}");
    10     shellObject.SendKeys("{R}");
    11 
    12     await Task.Delay(100);
    13     shellObject.SendKeys("{TAB}");
    14     shellObject.SendKeys("{TAB}");
    15     shellObject.SendKeys("{TAB}");
    16     shellObject.SendKeys("{A}");
    17 
    18     await Task.Delay(100);
    19     shellObject.SendKeys("{ENTER}");

    如上步骤如下,

    1. 打开IE设置-安全 Tab
    2. 等待窗口焦点转移(0.5ms) -- 因为当前的焦点,是在界面触发点位置,比如按钮
    3. 模拟手动操作,将安全级别重置为默认级别
    4. 模拟手动操作,点击应用
    5. 关闭选项窗口

    如上步骤中,等待的时间并非一定的,是个人根据调试结果,设置的一个貌似OK的值。

    Rundll32 Commands 列表参考:List of Rundll32 Commands in Windows 10

    Github地址:IE环境修复工具

  • 相关阅读:
    装饰
    统一软件开发过程之2:用例文本书写
    统一软件开发过程之1:创建领域模型
    工厂方法
    volatile
    中介者
    建造者
    C#委托,事件与回调函数
    控件资源嵌入
    装饰
  • 原文地址:https://www.cnblogs.com/kybs0/p/10951951.html
Copyright © 2011-2022 走看看