开发者

Hide all windows for a process (ex. Internet Explorer)

I am using WatiN to script action开发者_高级运维s in Internet Explorer that run in the background of the user's machine. (I know...hacky). I am able through WatiN to make the Internet Explorer window not show. However, during my script, some HTML dialogs are opened. I am able to hide them using the P-Invoke ShowWindow in User32.dll, but they still appear for a second or so while I find the HWnd for the dialog. My question is:

Is there a way to stop a process from showing any windows?

Thanks


I'm assuming you tried the AutoCloseDialogs property on the IE object's Settings property in WatiN?

One option would be to run the whole thing under a different user account. I'm not sure what is invoking WatiN but the CreateProcessAsUser Windows API will, by default, put whatever processes it create's in a separate interactive desktop i.e. not the current user's one. This blog post has some info on calling CreateProcessAsUser from .net.


ie.ShowWindow(NativeMethods.WindowShowStyle.Hide);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜