打开隐藏Internet Explorer窗口没有它得到重点是什么? [英] Opening a Hidden Internet Explorer Window without it getting Focus?

查看:142
本文介绍了打开隐藏Internet Explorer窗口没有它得到重点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开一个隐藏的Internet Explorer窗口没有它偷焦点。我打开Internet Explorer中每5分钟检查更新网站Timer对象。问题是,每次检查更新时,它抢断重点从前台运行的应用。下面是我如何开始这个过程:

I want to open a hidden Internet Explorer window without it stealing focus. I have a Timer object that opens Internet Explorer every 5 minutes to check a website for updates. The problem is every time it checks for updates, it steals focus from the current application in the foreground. Below is how I start the process:

        Process m_Proc = new Process();
        m_Proc.StartInfo.Arguments = String.Format("{0}{1}", "-nomerge ", browserURL);
        m_Proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        m_Proc.StartInfo.UseShellExecute = true;
        m_Proc.StartInfo.CreateNoWindow = true;
        m_Proc.StartInfo.FileName = String.Format("iexplore.exe");
        m_Proc.Start();

它总是偷焦点,即使当它被隐藏。我希望它这样开始什么也没发生,因此用户可以继续在他们在做什么工作。谢谢你。

It always steals focus, even when it is hidden. I want it to start like nothing is happening, so users can continue to work on what they are doing. Thanks.

推荐答案

尝试通过它的COM接口自动的Internet Explorer,而不是明确的创建进程。 这里是如何该可以做到的。只是不要做 ie.Visible = TRUE ,它会留下隐患。呼叫 ie.Quit()当它完成。

Try automating Internet Explorer via its COM interfaces rather than creating a process explicitly. Here's how it can be done. Just don't do ie.Visible = true and it will stay hidden. Call ie.Quit() when done with it.

这篇关于打开隐藏Internet Explorer窗口没有它得到重点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆