Page 6 of 6

Posted: Tue Nov 28, 2006 11:31 am
by lexvictory
Dare wrote:I am getting the same crash with invalid memory access.

Code: Select all

If DocumentDispatch\QueryInterface(?IID_IHTMLDocument2, @WebGadget_Document.IHTMLDocument2) = #S_OK
Windows XP pro, just using the include and the example originally posted.

Don't have a clue as to how to fix it.
i found whats actually causing the error, it this line:

Code: Select all

If Browser\get_Document(@DocumentDispatch.IDispatch) = #S_OK
because event tho it gets past the If, it doesnt actually fill the variable with the interface....

i have no idea how to fix this particular error; it only seems to happen in unicode mode...

Posted: Tue Nov 28, 2006 1:02 pm
by freak
It appears, that when there is actually no document object to return, (for
example there is no page, or it is not fully loaded)
this method actually returns #S_OK, but leaves the pointer at 0.
This is not common COM behaviour. Its quite weird in fact.

Just check in an extra If that DocumentDispatch is not 0 and it should be fine.

I actually added this check in one place, but forgot it in another.
The file linked in my first post is now updated. sorry about this.

Posted: Tue Nov 28, 2006 1:17 pm
by lexvictory
thanks, now it works fine (i added in the If manually coz ive made mods to the code myself), although, if the webgadget isnt opened with the about:blank url, it doesnt open correctly.... (webgadget_open function)

Posted: Fri Feb 16, 2007 2:51 pm
by utopiomania
I just checked this code with IE7 because I have started a little project which will
benefit from a web-like GUI, and it works, but not if compiled into unicode.

In that case webGadget_open() always returns 0. Hope you can fix it.

EDIT: http://www.purebasic.fr/english/viewtopic.php?t=25886

Posted: Sun Nov 04, 2007 7:24 pm
by Seymour Clufley
I've been trying this with custom HTML code. I load it into the webgadget with SetGadgetItemText, wait until webgadget finishes loading, then set the CatchLinks callback.

It correctly gets the number of hyperlinks (you can see this in the "LinkCount" variable) but then it crashes!

This is not being done in a thread, by the way.

The hyperlinks are nothing special, either. They're just dummy links to obvious stuff like hotmail, yahoo etc.

Is it necessary to use the "Webgadget_Open" function with the CatchLinks function?

My computer is Windows XP-Professional SP2. It is not connected to the internet - could that be the problem?