Using IHTMLDocument2

Just starting out? Need help? Post your questions and find answers here.
ukandrewc
User
User
Posts: 31
Joined: Fri May 28, 2004 12:07 am

Using IHTMLDocument2

Post 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
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

quidquid Latine dictum sit altum videtur
ukandrewc
User
User
Posts: 31
Joined: Fri May 28, 2004 12:07 am

Post 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
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
ukandrewc
User
User
Posts: 31
Joined: Fri May 28, 2004 12:07 am

Post 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
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
ukandrewc
User
User
Posts: 31
Joined: Fri May 28, 2004 12:07 am

Post by ukandrewc »

Thanks Fred

I'll have a look at that.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Take a look at COMLib too - posted in the Announcements forum.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
ukandrewc
User
User
Posts: 31
Joined: Fri May 28, 2004 12:07 am

Post 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.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post 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?

:?:
@}--`--,-- A rose by any other name ..
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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.
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post 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.
@}--`--,-- A rose by any other name ..
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

This is just spam. I have deleted that post.

Timo
quidquid Latine dictum sit altum videtur
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Appreciated. Thanks.
@}--`--,-- A rose by any other name ..
Post Reply