是否可以在C#中编写服务应用程序
答案 0 :(得分:1)
1.检查当前活动窗口是否为Web浏览器
Process[] ieProcs = Process.GetProcessesByName("IEXPLORE");
System.Diagnostics.Process[] ieProcs = Process.GetProcessesByName("IEXPLORE");
答案 1 :(得分:1)
using System.IO;
...
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass();
string filename;
foreach ( SHDocVw.InternetExplorer ie in shellWindows )
{
filename = Path.GetFileNameWithoutExtension( ie.FullName ).ToLower();
if ( filename.Equals( "iexplore" ) )
Console.WriteLine( "Web Site : {0}", ie.LocationURL );
if ( filename.Equals( "explorer" ) )
Console.WriteLine( "Hard Drive : {0}", ie.LocationURL );
}