Why does Microsoft have IHTMLDocument, IHTMLDocument2, ... , IHTMLDocument8?
Asked Answered
P

4

7

What is the meaning of the number in the end of the interface name? I see that IHTMLDocument3-7 have no members (see example for #5), and 8 has gesture related members. Is the number derived from Windows version?

Phototransistor answered 1/1, 2013 at 7:16 Comment(1)
The no members doc bug is a regression that since been fixed...Hardandfast
E
20

This is a general feature of public COM interfaces.

If you want backward compatibility, you never want to change a published interface, because that would mean all the code people wrote for, say, IE 6 stops working with IE 7, and all of their customers get mad at them, and they get mad at you.

So, if IE 5 adds new features that needed to be exposed, instead of changing IHTMLDocument, you create a new interface, and make IE5 support both (by inheritance, QueryInterface, or some more explicit mechanism). And when IE 7.0.2 or IE 8 or Win XP or whatever adds even more new features, you create another one. And so on.

While MS could have come up with descriptive suffixes instead of just sequential numbers, that would probably be more confusing than helpful. So, IHTMLDocument2, IHTMLDocument3, etc. are the names. They don't mean anything, except the order they were added.

Electronegative answered 1/1, 2013 at 7:38 Comment(0)
O
3

What is the meaning of the number in the end of the interface name?

That is the standard convention for versioning COM interfaces. IXXX2 extends IXXX with new functions. IXXX3 extends IXXX2 with new functions, and so on. This allows clients to use older functions without breaking when new versions are released, and use newer functions when desired, even check if those functions are available before trying to call them.

I see that IHTMLDocument3-7 have no members

Where did you get that idea from? Look at their actual definitions. They expose many new members from one interface to the next.

Organza answered 1/1, 2013 at 8:37 Comment(1)
Indeed. Looking at mshtml.h in the SDK is often fun and enlightening.Gregggreggory
R
2

No - it just signifies a different version of the interface. It has nothing to do with Windows version (and, for that matter, little/nothing to do with MSHTML version):

Reggi answered 1/1, 2013 at 7:24 Comment(0)
E
1

as of http://msdn.microsoft.com/en-us/library/aa752541(v=vs.85).aspx

where we can see :

The IHTMLDocument3 interface inherits from the IDispatch interface but does not have additional members.

it can bee little confusing for newcomers to interface world.

Elizbeth answered 24/6, 2013 at 20:14 Comment(1)
IHTMLDocument3 does have more members. The quality of micro$oft's documentation is just ineffably awful.Zeitgeist

© 2022 - 2024 — McMap. All rights reserved.