zoukankan      html  css  js  c++  java
  • 关闭IE进程出错,提示拒绝访问


    解决办法:
      对关闭的进程设置一些属性,然后再执行process.kill()
     

    代码

     1 System.Diagnostics.Process[] myProcesses = System.Diagnostics.Process.GetProcesses();
     2 
     3             foreach (System.Diagnostics.Process myProcess in myProcesses)
     4             {
     5                 if (myProcess.ProcessName.ToUpper() == "IEXPLORE")
     6                 {
     7 
     8                     try
     9                     {
    10                         myProcess.StartInfo.FileName = "iexplore.exe";
    11                         myProcess.StartInfo.Arguments = "";
    12                         myProcess.StartInfo.WorkingDirectory = "";
    13                         myProcess.StartInfo.UseShellExecute = false;
    14                         myProcess.StartInfo.RedirectStandardInput = true;
    15                         myProcess.StartInfo.RedirectStandardOutput = true;
    16                         myProcess.StartInfo.RedirectStandardError = true;
    17                         myProcess.StartInfo.ErrorDialog = false;
    18                         myProcess.StartInfo.CreateNoWindow = true;                       
    19                          myProcess.Kill();
    20                         
    21                     }
    22                     catch(Exception ex)
    23                     {
    24                         txtlog.Write("关闭IE文件出错!"+ex.Message);
    25                         
    26                         continue;
    27                     }
    28                 }
    29             }
    View Code
  • 相关阅读:
    HDU --1251
    POJ -- 2436
    POJ -- 3140
    POJ 3107
    POJ -- 2002
    POJ -- 1655
    lintcode154
    lintcode192
    lintcode582
    lintcode901
  • 原文地址:https://www.cnblogs.com/Maculish/p/5032414.html
Copyright © 2011-2022 走看看