After the success of the diagram below:
The code is as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Using System. IO;
The namespace ConsoleApplication1
{
Class Program
{
The static void Main (string [] args)
{
SHDocVw. ShellWindows ShellWindows=new SHDocVw. ShellWindows ();
Bool hasCurrentUrl=false;
Foreach (SHDocVw InternetExplorer browser in shellWindows)
{
If (string. IsNullOrEmpty (the FullName))
{
continue;
}
The string filename=Path. GetFileNameWithoutExtension (the FullName). ToLower ();
If (filename. Equals (" iexplore ") & amp; & The LocationURL. The Contains (" https://www.baidu.com "))
{
HasCurrentUrl=true;
Console. WriteLine (" GetFileName (' {0} ') returns' {1} ", filename, hasCurrentUrl);
Console.ReadLine();
break;
}
}
If (hasCurrentUrl==false)
{
Console. WriteLine (" corresponding url was not found ");
Console.ReadLine();
}
}
}
}
Can manually open the IE browser and open https://www.baidu.com
CodePudding user response:
Ie there is no such functionCodePudding user response:
SHDocVw. ShellWindows () is the product of the dot-com era, including resource manager and Internet explorer window, through it can really get IE to open the window,CodePudding user response:
Sometimes page will automatically jump, the Url will change,