该函数可对窗口类进行查找,如成功则返回窗口句柄。 参数:1.lpclassName:类名;可通过winsight32来查找。 2.lpwindowname:标题; for example: hWnd:THandle; hWnd:=FindWindow(nil,windowsname); if hWnd<>0 then ...... else ......
public bool IsRun() { System.Diagnostics.Process [] pros = System.Diagnostics.Process.GetProcesses(); for(int i = 0; i < pros.Length; i++) { if(pros[i].ProcessName == "WINWORD.EXE") return true;//已运行 } return false;//没有运行 }
Process [] pro=Process.GetProcessesByName("xxxx"); if(pro.Length>0) { ...... }
参数:1.lpclassName:类名;可通过winsight32来查找。
2.lpwindowname:标题;
for example:
hWnd:THandle;
hWnd:=FindWindow(nil,windowsname);
if hWnd<>0 then
......
else
......
{
System.Diagnostics.Process [] pros = System.Diagnostics.Process.GetProcesses();
for(int i = 0; i < pros.Length; i++)
{
if(pros[i].ProcessName == "WINWORD.EXE") return true;//已运行
}
return false;//没有运行
}
if(pro.Length>0)
{
......
}