Jump to content

$IEComErrorNumberHex = 00000000


Recommended Posts

I have a button on a html page that fires an event handler .

$IEComErrorNumberHex = 00000000 is produced whenever the button is clicked from within a html page where the event function writes to the body or document (_IEBodyWriteHTML or _IEDocWriteHTML) :

Is this an _IE bug? or is there something else wrong?

Func my_Event_onpropertychange()

$testValue = $testValue +1 ;event handler for myevent inputbox

$val = $myevent.value & $testValue ;increment value for testing

_IEBodyWriteHTML($oFrameMain,$val) ;throws error if ie button clicked but no error if the gui button clicked

EndFunc

If I call the same function by clicking a gui button no error warning is raised.

I really hate seeing the warning message so have found a workaround :

Func my_Event_onpropertychange()

$testValue = $testValue +1 ;event handler for myevent inputbox

$val = $myevent.value & $testValue ;increment value for testing

;_IEBodyWriteHTML($oFrameMain,$val) ;throws error if ie button clicked but no error if the gui button clicked

;try this instead - no error:

$oBody = _IETagNameGetCollection($oFrameMain, "body", 0)

$oBody.innerHtml=$val

EndFunc

Here is the full script i put together for testing html button click VS gui button click, please try click the gui button for no error. Any suggestions to overcome the console warning messages appreciated:

#include <GUIConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister ()
Dim $oIE = _IECreateEmbedded ()
Dim $sHtml
Global $page
Global $oBody 
Dim $oFrameTop
Dim $oFrameMenu
Dim $oFrameMain
Dim  $adUseClient = 3;
Dim $myevent,$oEvent
Dim $go_Button,$oEvent2

Dim $testValue


Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1); OnEvent mode
$gui = GUICreate("Amba-view", 800, 600,-1,-1,$WS_OVERLAPPEDWINDOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetFont (8,-1,"Arial")
$testButton = GUICtrlCreateButton("Test",10,10,50)
GUICtrlSetOnEvent(-1,"my_Event_onpropertychange")
Dim $GUIActiveX = GUICtrlCreateObj($oIE, 1,50,798,580)
_IENavigate ($oIE, "about:blank")

_build_frames()
GUISetState ()

While 1
  Sleep(1000); Idle around
WEnd



    Func _build_frames()
        $sHTML = ""
        Out("<HTML>")
        Out("<HEAD>")
        Out("<TITLE>Amba-view</TITLE>")
        Out("<style>FRAMESET{border:0;}</style>")
        Out("</HEAD>")
        Out("<FRAMESET cols=""150,*"">")
        Out("   <FRAME NAME=Menu SRC=about:blank>")
        Out("   <FRAME NAME=Main SRC=about:blank>")
        Out(" </FRAMESET>")
        Out("</HTML>")

        _IEDocWriteHTML ($oIE, $sHtml)
        _IEAction ($oIE, "refresh")
         $oFrameMenu = _IEFrameGetObjByName ($oIE, "Menu")
         $oFrameMain = _IEFrameGetObjByName ($oIE, "Main")
         
        Call( _Menu_Html() )
        Call( _Main_Html() )
        
    EndFunc
    
    Func _Main_Html()
        $sHtml = ""
        Out("<HTML>")
        Out("<HEAD>")
        Out("<TITLE>Main</TITLE>")
        Out("<style>body{border:0;background:#FFF;font size:8pt;font-family:arial}")
        Out("table,th,td{font size:11px;border:1px solid;}")
        Out("th{font-weight:bold;}")
        Out("A:link {COLOR: #0000EE;}")
        Out("A:hover {COLOR: #0000EE;}")
        Out("A:visited {COLOR: #0000EE;}")
        Out("A:hover {COLOR: #0000EE;}")
        Out("</style>")
        Out("</HEAD>")
        Out("<body>")
        Out("<p>Welcome to Amba-view</p>")
        Out("</body>")
        Out("</HTML>")
        _IEDocWriteHTML($oFrameMain,$sHtml)
        _IEAction ($oFrameMain, "refresh")
        
    EndFunc
    
    Func _Menu_Html()
        $sHtml = ""
        Out("<HTML>")
        Out("<HEAD>")
        Out("<TITLE>Menu</TITLE>")
        Out("<style>body{border:0;background:#EEEEEE}>")
        Out("A:link {COLOR: #0000EE;}")
        Out("A:hover {COLOR: #0000EE;}")
        Out("A:visited {COLOR: #0000EE;}")
        Out("A:hover {COLOR: #0000EE;}")
        Out("</style>")
        Out("</HEAD>")
        Out("<body>")
        Out("<form name=""eventform"">")
        Out("<input id=""myevent"" type=text>")
        Out("</form>")
        Out("<p><a href=""java script:void(0);"" onclick=""parent.document.frames[0].document.getElementById('myevent').value='page=1&id=5';return false;"">Test</a></p>")
        Out("</body>")
        Out("</HTML>")
        _IEDocWriteHTML($oFrameMenu,$sHtml)
        $myevent = _IEGetObjByName ($oFrameMenu, "myevent")
        $oEvent = ObjEvent( $myevent, "my_Event_")
    EndFunc

    
    Func my_Event_onpropertychange()
        $testValue  = $testValue +1;event handler for myevent inputbox
        $val = $myevent.value & $testValue;increment value for testing      
        _IEBodyWriteHTML($oFrameMain,$val);throws error if ie button clicked but no error if the gui button clicked
;try this instead - no error:
;$oBody = _IETagNameGetCollection($oFrameMain, "body", 0)
;$oBody.innerHtml=$val

    EndFunc
    
    Func Out($temp)
        $sHtml &= $temp & @CR
    EndFunc

    Func CLOSEClicked()
        Exit   
    EndFunc
Edited by Will66
Link to comment
Share on other sites

Good reproducer, I can see what you're talking about. Your code is writing effectively writing only $val between your <BODY> tags in the main frame, not sure if that's desired or not. In any case, though the error isn't fatal, it seems a bit odd to me. It's effectively returning a 'number' equal to a blank string. Better let Dale have a look at this one.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Interesting. The meat of _IEBodyWriteHTML is working fine (no surprise since it does essentially what the alternate code you provided does.

The trouble is coming from the _IELoadWait that _IEBodyWriteHTML is calling. A COM error is being raised (I haven't found the trigger for that yet) and then the error object appears to be invalid in the internal error handler... the HEX error is actually Null, but ends up displaying as zeros.

This is going to take a little digging.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Dale, in _IEBodyWriteHTML, why are you passing _IELoadWait the document instead of the IE object at the end? When I change this, the error stops - but I don't know if it breaks something somewhere else.

Local $oTemp = $o_object.document
_IELoadWait($oTemp)

change To 

;Local $oTemp = $o_object.document
_IELoadWait($o_object)
Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Thanks lod3n.

Well, in fact it is the document readyState we are interested in. Just because the document container (window/frame/InternetExplorer) is "ready" does not guarantee that the document inside is also ready.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Dale, in _IEBodyWriteHTML, why are you passing _IELoadWait the document instead of the IE object at the end? When I change this, the error stops - but I don't know if it breaks something somewhere else.

Local $oTemp = $o_object.document
_IELoadWait($oTemp)

change To 

;Local $oTemp = $o_object.document
_IELoadWait($o_object)

or lower level DOM calls as you wish.

Thanks for reporting this and for providing the reproducer.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

This is interesting. I modified _IEBodyWriteHTML as follows:

ConsoleWrite("+ Starting loadwait..." & @CRLF)
    _IELoadWait($oTemp)
    ConsoleWrite("+ loadwait complete." & @CRLF)

When running this test, my console outputs the following:

+ Starting loadwait...

+ loadwait complete.

--> COM Error Encountered in weird error.au3

----> $IEComErrorScriptline =

----> $IEComErrorNumberHex = 00000000

----> $IEComErrorNumber =

----> $IEComErrorWinDescription =

----> $IEComErrorDescription =

----> $IEComErrorSource =

----> $IEComErrorHelpFile =

----> $IEComErrorHelpContext =

----> $IEComErrorLastDllError =

Note that the error occurs AFTER _IELoadWait returns, which seems to indicate that something is looking for something that isn't there anymore. I think the problem has something with how the AutoIt.Error COM event handler is being passed around, but I'm not sure...

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...