How to obtain process of newly created IE8 window?

前端 未结 2 651
深忆病人
深忆病人 2021-01-20 18:40

When using .NET\'s Process.Start to run IE8\'s iexplore.exe, and if you already have another IE8 window open, then the iexplore.exe process that you just started will immedi

相关标签:
2条回答
  • 2021-01-20 19:01

    I did it using a non-optimal solution - get a list of all iexplore.exe process IDs before running my iexplore.exe, then get the same list again after iexplore.exe is invoked. Do a diff between the two lists, the extra PID will be the one I've created. This of course won't work in certain cases (other apps or the user started extra iexplore.exe processes while the detection code is running, or IE did some kind of rearrange/recreation of processes as an internal maintenance task).

    0 讨论(0)
  • 2021-01-20 19:17

    As a workaround you may want to force IE to start a new instance (passing -nomerge command line argument):

    Process objProcess = Process.Start("IEXPLORE.EXE", "-nomerge http://google.com/");
    
    0 讨论(0)
提交回复
热议问题