错误是可以拦截的,参考Obj管理一章
只是版主这个,不清楚究竟这样触发ObjEvent,有例子就好办了。 我想拦截NewWindow事件,我现在能做到的就是获取NewWindow事件的信息,但是拦截不住 回复 1# guland
请使用该段代码!!
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
$oIE = ObjCreate("Shell.Explorer.2"); open the com openject
$oEvt = ObjEvent($oIE,"IEEvent_","DWebBrowserEvents"); attach the DWebBrowserEvents where 'BeforeNavigate' is part of
GUICreate(@ScriptName, 800, 600, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUICtrlCreateObj($oIE, 0, 0, 800, 600); make the com object visible
GUISetState()
With $oIE; make a object pool
.RegisterAsBrowser = True
.RegisterAsDropTarget = True
.TheaterMode = True
.Resizable = False
.navigate("http://www.baidu.com")
EndWith
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
Exits()
Func IEEvent_BeforeNavigate($url,$Flags,$TargetFrameName,$PostData,$Headers,$Cancel)
_say('before Navigate Event notified')
_say($url)
_say($Flags)
_say($TargetFrameName)
_say($PostData)
_say($Headers)
_say($Cancel)
EndFunc
Func IEEvent_NewWindow($url,$Flags,$TargetFrameName,$PostData,$Headers,$Cancel)
MsgBox(0,"----------guland--------------","点击确定谢谢我吧~~~")
_say('Newwindows')
_say($url)
_say($Flags)
_say($TargetFrameName)
_say($PostData)
_say($Headers)
_say($Cancel)
EndFunc
Func Exits()
GUIDelete()
$oEvt = 0
$oIE = 0
Exit
EndFunc
Func _Say($tx)
ConsoleWrite($tx & @CR)
EndFunc 回复 19# republican
非常感谢,不过我需要的是拦截NewWindow事件,让鼠标点击链接之后不执行接下来的动作,也就是NewWindow,我的代码的目前为止的功能跟你的是一样的,支持代码没有你的那么复杂,
根据我掌握的资料只能试试DWebBrowserEvents2才行,但是DWebBrowserEvents2在AU3里面貌似支持不好
不过还是非常非常的感谢republican 不要沉,相信一定会有解决办法的 回复 21# guland
估计是不行的了:
DaleHohm
Think of IE as an API...
Group: AutoIt MVPs(MVP)
Posts: 5,101
Joined: 14-March 05
Location:Colorado
Posted 14 May 2008 - 07:42 PM
You're right. The NewWindow2 and NewWindow3 events are either not firing or are not being trapped. I cannot explain it.
地址:
http://www.autoitscript.com/forum/index.php?showtopic=71155&st=0&p=521477&hl=NewWindow2&fromsearch=1&#entry521477 回复 22# republican
老外解决不了的事情不代表我们解决不了{:face (317):} 回复 23# guland
那我就等待你的喜讯啦~~
{:face (356):} 回复 24# republican
是在不行我用E语言编个DLL给AU3调用哈哈 回复 25# guland
顺带做个多线程的吧~~~ 回复 26# republican
............................{:1_489:} 能做到,au3有改源码的IE函数 我也试了好几种方法,的确是挡截不到 回复 28# 风行者
能否提供一下呢?
页:
1
[2]