找回密码
 加入
搜索
查看: 3139|回复: 5

[IE类操作] 内嵌IE不弹出新窗口

  [复制链接]
发表于 2014-10-8 17:03:22 | 显示全部楼层 |阅读模式
本帖最后由 xuerilangzi 于 2014-10-8 17:05 编辑
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ie.au3>
$oIE = ObjCreate("Shell.Explorer.1")

#Region ### START Koda GUI section ### Form=
$GUIMain = GUICreate("GUIMain", 800, 600, 0, 0)
GUICtrlCreateObj($oIE, 0, -0, 800, 600)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents")
$URL = "http://www.hao123.com/"
$oIE.Navigate( $URL ) 

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

Func IEEvent_NewWindow($ppDisp,$Cancel)
        Local $o_Shell = ObjCreate("Shell.Application")
        Local $o_ShellWindows = $o_Shell.Windows(); collection of all ShellWindows (IE and File Explorer)
        For $i = $o_ShellWindows.Count-1 To 0 Step -1
                If $o_ShellWindows.item($i).LocationURL==$ppDisp Then
                        $o_ShellWindows.item($i).quit()
                EndIf
        Next
        $oIE.Navigate( $ppDisp )        
EndFunc 
发表于 2014-10-9 11:46:58 | 显示全部楼层
学习了,如果支持NewWindow2就更简单了
发表于 2014-10-10 02:21:14 | 显示全部楼层
感谢楼主解决了我内嵌IE的一个问题!!
发表于 2014-10-10 10:13:13 | 显示全部楼层
此贴很棒,经典~
发表于 2014-10-11 09:45:28 | 显示全部楼层
没用啊 还是弹出新窗口了啊 点击里面的链接
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-30 02:07 , Processed in 0.076284 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表