guland 发表于 2010-6-25 08:43:51

使用ObjEvent会出错?什么情况?

高手帮我看看下面的代码,使用ObjEvent之后,打开新窗口的时候会AU3会崩溃#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 238, 175)
$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE, 4, 4, 607, 389)
$Button1 = GUICtrlCreateButton("Button1", 12, 402, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 90, 402, 75, 25)
ObjEvent($oIE, "command")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_IENavigate($oIE, "http://www.baidu.com")
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd
func conmand()
msgbox(0,"","111")
EndFunc

republican 发表于 2010-6-25 10:23:18

本帖最后由 republican 于 2010-6-25 10:27 编辑

上述代码在我电脑上运行无错误。

你声明的Obj想干嘛?

接受IE返回信息的话我就不知道了。

如果是接受错误的话,不是这么用的。

用法参考帮助文档:
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; 建立自定义错误处理程序

; 在这里执行一个预设故障(对象不存在)
$oIE = ObjCreate("InternetExplorer.Application")
;-------------------------------------------

另外,ObjEvent的结果请传递到变量,没有变量的ObjEvent不起作用(至少我测试Autoit.error 如此)。






ms明白了一点, ObjEvent捕捉到新对象后,不知道该怎么做...

guland 发表于 2010-6-25 11:09:32

本帖最后由 guland 于 2010-6-25 11:11 编辑

回复 2# republican


    我只是想拦截一些信息,不是错误信息,
你试试右键,新窗口中打开,看看AU3会不会崩溃,正常在当前窗口打开连接时没有问题的
但是在新窗口中打开就会崩溃

我只是简单的举个例子,所以不需要加变量

republican 发表于 2010-6-25 11:49:41

回复 3# guland

嗯嗯, Shell.Explorer.2 有没有更多的说明?

guland 发表于 2010-6-25 12:04:16

回复 4# republican


    没有..{:face (229):}

republican 发表于 2010-6-25 12:31:48

回复 5# guland

ObjEvent($oIE, "command_",'IWebBrowser2')

这样子可以执行不会出错,现在需要知道的是Objevent传递了什么过来。

guland 发表于 2010-6-25 12:39:38

回复 6# republican


    那样做是不出错了,可是AU3拦截不到任何函数了,比如BeforeNavigate2等等

hzxymkb 发表于 2010-6-25 12:40:23

哈哈!又学到一招!高人真是无处不在呀!

guland 发表于 2010-6-25 12:50:07

回复 8# hzxymkb


    你学到啥了啊? 是不是你把我的问题解决了啊{:face (396):}

hzxymkb 发表于 2010-6-25 12:59:00

回复 9# guland
您的问题高难度!我解决不了!
我只是学到了6楼朋友的那一招!
给您造成误会!对不起咯!

guland 发表于 2010-6-25 14:42:31

{:face (370):}自己顶一下,到英文网站上逛了一圈也没有什么结果...

guland 发表于 2010-6-25 18:23:19

{:face (203):}人都哪去了啊....

republican 发表于 2010-6-25 18:33:50

hoho,无解......估计N人都不用IE内嵌...直接正则....

itljl 发表于 2010-6-25 18:43:03

OBJ怎么拦截错误提示呢?AU3貌似直接就退出了。

guland 发表于 2010-6-25 19:00:36

易语言之类的都能拦截,AU3以拦截就出错....
页: [1] 2
查看完整版本: 使用ObjEvent会出错?什么情况?