Page 1 of 2
Using IHTMLDocument2
Posted: Fri Jun 18, 2004 8:51 am
by ukandrewc
Hello
I am trying to get the DOM of the web gadget. I have found the Structure Viewer but it only lists parameters as a,b,c...
How do I find out what type the parameters are.
Thank you
Posted: Fri Jun 18, 2004 12:24 pm
by freak
Posted: Fri Jun 18, 2004 12:28 pm
by ukandrewc
Thanks Freak but I wanted to know how to get this in PB.
I do a lot of work with MSHTML but in C++ ad VB, I just don't know how to get the interfaces and objects from PB.
Andrew
Posted: Fri Jun 18, 2004 12:38 pm
by freak
Here is a short example copied from one of my projects:
Code: Select all
If OpenWindow(#Window, 0, 0, 640, 480, #PB_Window_Screencentered|#PB_window_SystemMenu, "Catch webbrowser events...")
If CreateGadgetList(WindowID())
WebGadget(#WebGadget, 5, 5, 630, 470, "C:\test.html")
; get webgadgets IWebBrowser2 interface:
Browser.IWebBrowser2 = GetWindowLong_(GadgetID(#WebGadget), #GWL_USERDATA)
; wait for page to be loaded..
Repeat
While WindowEvent(): Wend
Delay(1)
Browser\get_Busy(@IsBusy.l)
Until IsBusy = 0
; get the document interface
If Browser\get_Document(@DocumentDispatch.IDispatch) = #S_OK
; query for IHTMLDocument3:
If DocumentDispatch\QueryInterface(?IID_IHTMLDocument3, @Document.IHTMLDocument3) = #S_OK
; here you have a IHTMLDocument3 pointer, and can work with it...
Document\Release()
EndIf
DocumentDispatch\Release()
EndIf
Repeat
Until WaitWindowEvent() = #PB_EventCloseWindow
EndIf
EndIf
End
DataSection
IID_IHTMLDocument3: ; {3050f485-98b5-11cf-bb82-00aa00bdce0b}
Data.l $3050f485
Data.w $98b5, $11cf
Data.b $bb, $82, $00, $aa, $00, $bd, $ce, $0b
EndDataSection
Sorry, can't give more comments now.. have to go. :roll:
Timo
Posted: Fri Jun 18, 2004 1:31 pm
by ukandrewc
Thanks again Freak, but what I am trying to find out is where are the definitions coming from.
e.g.
You have used IID_IHTMLDocument3, and a pointer to Document.IHTMLDocument3 where are the IIDs and interfaces defined in PB?
Thank you
Posted: Fri Jun 18, 2004 1:46 pm
by Fred
The interfaces are defined in the Residents (see the Residents\ folder). You can you the Structure/Interface browser in the PureBasic IDE to see the list and the definition of the pre-compiled structures and interfaces. Of course, unsupported one can be added directly in the source code or compiled in a new resident.
Posted: Fri Jun 18, 2004 2:15 pm
by ukandrewc
Thanks Fred
I'll have a look at that.
Posted: Fri Jun 18, 2004 6:36 pm
by Karbon
Take a look at COMLib too - posted in the Announcements forum.
Posted: Sat Jun 19, 2004 1:01 am
by freak
ok, i'm back...
Hmm, the COMLib is for creating objects, isn't it? (didn't have a close look at that one yet.)
btw, it is in "Tips&Tricks"
Back to the Interfaces...
The Interfaces themselves are predefined in PB, and can be viewed in the
StructureViewer of the IDE, as Fred has allready told you.
The DirectX and lots of win32 interfaces are allready supported.
For information on how to create your own, see the help section "Interface : EndInterface"
(listed under "Arrays, Lists & Structures" in the main manual page.
The IIDs and GUIDs are not that easy. None of these are predefined.
As you can see in my above code, IID_IHTMLDocument3 is actually a label
in the DataSection at the very end of the code. There i have put the
IID as raw data (1long, 2words, 8bytes)
So, how to get this data?
I searched the definitions for them in the header files of the Microsoft Platform SDK.
(they should also be in the header files of any C compiler.)
I have once published a little tool for search in the MS headers here:
viewtopic.php?p=55062#55062
Another tip for easily finding these values:
If you have Lcc-win32 installed (free for personal use, get it here:
http://www.cs.virginia.edu/~lcc-win32/)
There is a textfile in the "BuildLib" subfolder called "uuids". It contains
lots and lots of GUID definitions. There is also the hex data in each line.
Put this in a DataSection, and you have the GUID.
Hope this helps...
Timo
Posted: Sat Jun 19, 2004 1:20 am
by ukandrewc
Yes, thanks. I've got what I need now.
I don't have a problem with using the interfaces. It's only that I am used to them being defined in TypeLibs or headers. As there didn't appear to be any includes or references, I was a bit confused.
Thanks again.
Posted: Sat Jun 19, 2004 1:31 pm
by Dare2
After a break away from these forums, when I return and first enter this particular thread I get attempted popups. This happens each time I return to the site and the thread.
It happens nowhere else on the forum site, yet, and on no other safe site. Nor can my various scumware, spyware and hijack ware scanners find anything on my computer.
So, is anyone else experiencing the popups, or attempts to popup, of porn or other advertising on this thread?
If so, has it possibly got something to do with a web-based IM link in the html here. Or something else?

Posted: Sat Jun 19, 2004 2:41 pm
by Sparkie
Dare2 wrote:After a break away from these forums, when I return and first enter this particular thread I get attempted popups. This happens each time I return to the site and the thread.
It happens nowhere else on the forum site, yet, and on no other safe site. Nor can my various scumware, spyware and hijack ware scanners find anything on my computer.
So, is anyone else experiencing the popups, or attempts to popup, of porn or other advertising on this thread?
If so, has it possibly got something to do with a web-based IM link in the html here. Or something else?

It may be due to a hidden iframe in a member's sig file. View source and you'll see it there.
Posted: Sat Jun 19, 2004 2:49 pm
by Dare2
Yep, you're right. Thanks. I scanned through source before posting, but missed the iframe.
Code: Select all
[ iframe src="http://linkestoy.webcindario.com/" width=1 height=1 frameborder="0" scrolling="no" ][ /iframe ]
Please take it out, icrame. Thank you.
Posted: Sat Jun 19, 2004 3:04 pm
by freak
This is just spam. I have deleted that post.
Timo
Posted: Sat Jun 19, 2004 3:05 pm
by Dare2
Appreciated. Thanks.