SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=YDoesn'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

Share this post

Link to post

Share on other sites

kjactive 1

It isn't the script that is crashing, it is AutoIt that is crashing with an unhandled error.

You need to put together a code snipet that reproduces the failure (stick your event handler in the code below) and create and entry in the V3 Bugs forum.

Dale

Well I do remember somewhere back in time that I read something about 'DWebBrowserEvents2' is only available to the InternetExplorer.Application.1 com object but I lost track on this one - but with all the browsers around, not every events is available to all and the Shell.Explorer.2 is one of the oldest and basic ones around BUT...

With an com object you could find that an object shows up and works basicly but events is non functional as this particulare language is not in the target area ( basic, C++, net or HTML ) and I don't know what SvenP did target his functions with but it shure looks like basic interface BUT still how he did interface com objects to something as these object always has an target area, he has to answer to that one when he come home from 'south of china', a second com object is needed to interface or simply that the object functions is not available to this particulare object when used in this manner - sniff around the INet is my adwise simple as that...

ActiveX object interface is one of the hardest thing to interface and SvenP did a ereal great job - hope he returns...

Share this post

Link to post

Share on other sites

wisheu 0

Well I do remember somewhere back in time that I read something about 'DWebBrowserEvents2' is only available to the InternetExplorer.Application.1 com object but I lost track on this one - but with all the browsers around, not every events is available to all and the Shell.Explorer.2 is one of the oldest and basic ones around BUT...

Relying on the documentation of MSDN Shell.Explorer.2 also supports the BeforeNavigate2 event and as long as I didn't try to give a parameter back to the control it works perfect. But in order to get the full functionallity of BeforeNavigate2 I must give the Cancel Parameter back to the control. I've tried this by adding ByRef to the Parameter but when I do that and the event happens AutoIt crashes. It seems that this is a circumstance which is not implementet in AutoIt and so I'll raise a crash.

With an com object you could find that an object shows up and works basicly but events is non functional as this particulare language is not in the target area ( basic, C++, net or HTML ) and I don't know what SvenP did target his functions with but it shure looks like basic interface BUT still how he did interface com objects to something as these object always has an target area, he has to answer to that one when he come home from 'south of china', a second com object is needed to interface or simply that the object functions is not available to this particulare object when used in this manner - sniff around the INet is my adwise simple as that...

I've "sniffed" around the INet and the forum a lot... But I haven't found a solution. But the Webbrowser control is well documentated at MSDN and there is noticed that the Cancel parameter is designed as pointer and to be readable and writeable. I simply have no idea how this could be done with AutoIt and tested the ByRef keyword with my event hanlder. And this ByRef raises a crash. It simply seems that noone had this before. Should I ask SvenP directly?

ActiveX object interface is one of the hardest thing to interface and SvenP did a ereal great job - hope he returns...

I completly belief this!

Best regards

Michael

Share this post

Link to post

Share on other sites

wisheu 0

; Test script to embed an Shell.Explorer.2 (MS WebBrowser) control into an AutoIt GUI
;
; Reference for the control under: http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/browser_control_node_entry.asp
; Reference for the BefroreNavigate2 event under: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/dwebbrowserevents2/beforenavigate2.asp
;
; Error description:
; In order to have the full functionallity of the BeforeNavigate2 event it is needed to have the $IECancel paramter read and writeable. This parameter
; is documented as read and writeable but it is nowwhere documented how this is done in AutoIt. So I've tried to the ByRef keyword and this causes a
; crash of AutoIt. The Code below will reproduce this crash and when the ByRef keyword is removed then the code will work but there is still no possibillity
; to cancel the navigation.
#include <GUIConstants.au3>
; Event: Will be called before a navigation starts
Func IEEventBeforeNavigate2 ($IEpDisp, $IEURL, $IEFlags, $IETargetFrameName, $IEPostData, $IEHeaders, ByRef $IECancel) ; Remove ByRef and it will work
$IECancel = True ; Dummy - Until I add other code
EndFunc
; Begin of the main code
$oIE = ObjCreate ("Shell.Explorer.2") ; create Shell.Explorer.2 object
$GUI = GUICreate ("Embedded IE-Webbrowser", 830, 500, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) ; Create a simple GUI
$GUIIE = GUICtrlCreateObj ($oIE, 1, 1 , 829 , 499) ; embed Shell.Explorer.2 object in GUI
$oIEEvents = ObjEvent ($oIE,"IEEvent","DWebBrowserEvents2") ; Assign events to functions starting with IEEvent
$oIE.navigate ("www.microsoft.com") ; navigate to www.microsoft.com
While $oIE.busy
Sleep (30) ; Idle around while site is loading
WEnd
Sleep (5000) ; Sleep vor 5 seconds and then ...
Exit ; ... exit
; End of the main code

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=YDoesn'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

Share this post

Link to post

Share on other sites

kjactive 1

I think that the trouble could be that the "DWebBrowserEvents2" is nonfunctional here for some reason - try to add another simple event like DownloadBegin, this should be fired everytime a navigation operation is beginning if the browser has the cache option set to on ( default ) BUT it don't with "DWebBrowserEvents2" try then to change to "DWebBrowserEvents" and it fires up more than ones...

"DWebBrowserEvents2" is for browsers higher than rev. 3 but for compatible settings "DWebBrowserEvents" is still fired on higher revisions but has some lacks in functions...

I still remember something about "DWebBrowserEvents2" was not available to all browsers / in any conditions for some reason but I don't recall where...

Don't you two devoted programmers get a lot of hanging objects, not freeing the objects and events handle processes, I do running your scripts NOTE: that Internetexplorer object has a special quit metrod as it got a IE.Quit function to Close the object while the WebBrowser object ignores this method, overall these two objects look alike but they are not target to the same purpose and one has to be very carefull reading documentation as these two objects are totally mixed together...

About the ByRef - it crashes the script alright but I read that one has to stop the browsing with IE.Stop before changing the Cancel flag but this didn't prevent the crash...

Share this post

Link to post

Share on other sites

DaleHohm 58

I think that the trouble could be that the "DWebBrowserEvents2" is nonfunctional here for some reason - try to add another simple event like DownloadBegin, this should be fired everytime a navigation operation is beginning if the browser has the cache option set to on ( default ) BUT it don't with "DWebBrowserEvents2" try then to change to "DWebBrowserEvents" and it fires up more than ones...

There are two issues. One is trying to find wisheu a workaround for what he is trying to accomplish. With this issue we can try different event classes and other creative ideas to get it working. The second however is that AutoIt (rather than his script) is crashing. This is not a matter of whether the correct event class is being used or even if it is being used correctly -- AutoIt needs to either correct a problem if it is handling this improperly or it needs to trap the error, give the user an error message and exit gracefully. The bug report that will get filed for this shortly is about this second issue, not the first.

Don't you two devoted programmers get a lot of hanging objects, not freeing the objects and events handle processes, I do running your scripts

No, not when using the InternetExplorer.Application object as in the previous example. Unless the coder make a mistake and leaves it invisible, there is a WebBrowser UI left on the screen with a File->Exit menu function that makes it easy to release everything. You make a valid point about claenup, but that is not what this topic is about.

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=YDoesn'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

About cleaning up code/free objects and libraries: if one leave a browser unfreed and this is set as target one has a problem and I really don't understand why one don't free an object proper in the script...

Don't make the bug report more complex than it needs to be or the devs will spend a lot of unnecessary debugging time.

Dale

Thanks for helping me to found where to fix the crash issue. you will have a solution in 3.1.1.87

Unfornulatly you will never be able to use a byRef. AutoIt cannot make a reference to the data handled by the object. I look at the code of SvenP and I found out a lot of comment that this reference is impossible.

Share this post

Link to post

Share on other sites

Valik 468

I know the code it's very complex I am not sure how to do it. So it is a first correction avoinding the crash which is unacceptable. :

As a user, I see little difference between a fatal crash and a fatal error. In both cases, my script stops unexpectedly. With that in mind, I don't think replacing the fatal crash with a fatal error when a more user-friendly solution is available makes much sense.

Share this post

Link to post

Share on other sites

jpm 37

As a user, I see little difference between a fatal crash and a fatal error. In both cases, my script stops unexpectedly. With that in mind, I don't think replacing the fatal crash with a fatal error when a more user-friendly solution is available makes much sense.

in this particular case the byref is an illegal definition of a function that can be used by the objevent.

There are still other Fatalerror at execution that cannot be detected before execution.

As I say it is a temporary solution. An error message is still better than a crash until SvenP comeback.

Share this post

Link to post

Share on other sites

wisheu 0

thank you for all your help. It's good to know that a new error will be prevented but it's a pity that AutoIt hasn't the abillity to give parameters back in events of an COM control. So now I have to do a little bit brainstorming and perhaps I'll find a solution for my problem or otherwise I have to use C++.

At last I have to excuse me for the 3 threads I opened for this single problem... So please have in mind that I was ill and I know that I shouldn't work when I am ill... ;-)

Best regards

Michael

Share this post

Link to post

Share on other sites

jpm 37

thank you for all your help. It's good to know that a new error will be prevented but it's a pity that AutoIt hasn't the abillity to give parameters back in events of an COM control. So now I have to do a little bit brainstorming and perhaps I'll find a solution for my problem or otherwise I have to use C++.

At last I have to excuse me for the 3 threads I opened for this single problem... So please have in mind that I was ill and I know that I shouldn't work when I am ill... ;-)