PDA

View Full Version : How IE works? (Question to any WinAPI user)


Brian Nickel
21.08.2001, 21:31
I was looking through WinClasses and subclasses, and a thought struck me:
The page, the "_top" is a MSHTML window, but what about <TD> <DIV> <OBJECT> etc. Is a web page just a windows inside windows inside windows?

<font face='Courier New'>char* Name = "Brian";
char Country [3] = "USA";
int Age = 16;</font id='Courier New'>

wranlon
22.08.2001, 21:04
Short answer: no. _top is just a friendly way of asking IE to open the link in the top most frame. _blank is a friendly way of asking IE to open the link in a new instance.

And in greater detail ...

IE 4 - 5.5, and I imagine IE 6, is COM-based. The browser - where Web pages are displayed - is an instance of a web browser control, shdocvw.dll (or .oc?, but ultimately the dll). Some window dressing is added around the control, such as the menu, status, coolbar, and rebar controls.

When DHTML elements (the HTML text) are parsed by the parser (mshtml.dll, which is implemented with shdocvw.dll, plus a bunch of other helper dlls), the parsed objects are derived from an interface, such as IHTMLElement, and ultimately inherit from a common interface, IDispatch.

For example, <TD> would come from IHTMLTableCell, and <DIV> comes from IHTMLDivElement. Each of these interfaces exposes some public members (EG, BGCOLOR for the TD), and they inherit more members from IHTMLElement, such is ID and CLASS.

Scripting for JScript and VBScript is wrapped up in sccrun.dll. So, the DOM members get described in MSHTML and, I think to a limited extent, in SHDOCVW, but all the script stuff is described by scrrun.dll.

So, script gets handled by scrrun, and when that script tries to access DOM members, those get exposed by MSHTML.

Ok, enough of the gory background.

The way that IE is constructed, one way of describing it is to say there is nothing above the "window" object. Another way to say it is there is nothing above the implementation of shdocvw (apologies in advance if I'm off here).

For example: if you have IE 5.0+ installed, you also have a binary called mshta.exe. This lets you run an HTML Application, which has full access to your system. Mshta.exe is just a wrapper to the above DLLs.

So, in IE, the HTML elements, such as TD, DIV, and OBJECT become instances of an interface when they get parsed. A web page is hosted by instance of a control, which supports the parsed HTML elements (now HTML objects).

If you have VB, a real handy way of experimenting with this is to start a new EXE, include a project reference to an MS Internet Control (shdocvw) and MS HTML Object Library (mshtml), then use the Object Browser to spelunk how it is put together.

Hope that was somewhat helpful, and if not, at least somewhat accurate :)