Opened 15 years ago
Closed 14 years ago
#1973 closed Bug (No Bug)
_IEAttach failes and crashes on some special window constellations
| Reported by: | Samoth | Owned by: | Gary |
|---|---|---|---|
| Milestone: | Component: | Standard UDFs | |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | IE UDF HWND Error _IEAttach | Cc: | johannes@… |
Description
When there is a Web Browser window open not being a TopLevelContainer the function _IEAttach will exit with an error:
E:\Bin\autoit\install\Include\IE.au3 (2675) : ==> The requested action with this object has failed.: Return SetError($_IEStatus_Success, 0, HWnd($o_object.HWnd())) Return SetError($_IEStatus_Success, 0, HWnd($o_object.HWnd()^ ERROR
This can be solved by modifying IE.au3 checking whether your IE object is a TopLevelContainer and respond accordingly in Func _IEPropertyGet(ByRef $o_object, $s_property) from line 2669 on as described in my post in the forum. The problem is pretty well caught down over there.
[...] lines 1-2668
Case $s_property = "hwnd"
If Not __IEIsObjType($o_object, "browser") Then
__IEErrorNotify("Error", "_IEPropertyGet", "$_IEStatus_InvalidObjectType")
Return SetError($_IEStatus_InvalidObjectType, 1, 0)
EndIf
;--------------OLD-CODE:
;Return SetError($_IEStatus_Success, 0, HWnd($o_object.HWnd()))
;--------------NEW-CODE:
If $o_object.TopLevelContainer Then
Return SetError($_IEStatus_Success, 0, HWnd($o_object.HWnd()))
Else
Return SetError($_IEStatus_Success, 0, 0)
EndIf
;--------------:NEW-CODE
[...]
It was the same problem in ticket #1415 but this is already closed for not being precise enough. I hope this ticket will help out. As said in this post I should open a ticket. And I searched for a double before finding only this closed one ;-)

This is not bug and that's not solution.
Create and use COM error handler to avoid situations like that.