Dim $sUrl="http://www.baidusf.com/"
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc");加这行初始COM 对像句柄,这样就可以知道出错的原因了error handler
$oHTTP = ObjCreate("microsoft.xmlhttp")
$aa=$oHTTP.Open("GET",$sUrl,False)
ConsoleWriteError(@error)
$oHTTP.Send("");发送
Func MyErrFunc()
Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _
"err.description is: " & @TAB & $oMyError.description & @CRLF & _
"err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
"err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _
"err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
"err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
"err.source is: " & @TAB & $oMyError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oMyError.helpcontext _
)
Local $err = $oMyError.number
If $err = 0 Then $err = -1
$g_eventerror = $err ; to check for after this function returns
Endfunc
多谢afan版的指点.. |