Jump to content

DWebBrowserEvents2 Error


Recommended Posts

open new windows error.

http://support.microsoft.com/kb/184876

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister (" ie8 ")
$oIE = _IECreateEmbedded ()
$EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents2")
if @error then 
   Msgbox(0,"AutoIt COM Test", _ 
    "ObjEvent: Can't use event interface 'DWebBrowserEvents'. Error code: " & hex(@error,8))
   exit
endif
$GUI = GUICreate("",500,500)
$GUIActiveX = GUICtrlCreateObj($oIE,0,0,500,500)
_IENavigate ($oIE, "http://www.google.com",0)
GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func IEEvent_NewWindow2($ppDisp,$Cancel)        ;     Error  <----
    ;   http://support.microsoft.com/kb/184876
    $Cancel = True
EndFunc
Link to comment
Share on other sites

What error? Please describe your issue in words and sentences.

That said, you will not be able to use AutoIt COM event handing to cancel an operation such as this. AutoIt does not handle COM errors synchroneously, but rather can be though of as being informed of events instead of placing itself in the event processing flow. By the time you try to act on the event, the flow has already moved past it. Also note that the COM routines do not handle byRef values.

You'll need to inject javascript into the page to do what you want in this case.

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

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...