Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Microsoft have IHTMLDocument, IHTMLDocument2, ... , IHTMLDocument8?

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?

like image 480
zenpoy Avatar asked Jan 01 '13 07:01

zenpoy


4 Answers

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.

like image 84
abarnert Avatar answered Nov 10 '22 00:11

abarnert


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.

like image 45
Remy Lebeau Avatar answered Nov 10 '22 00:11

Remy Lebeau


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):

  • http://msdn.microsoft.com/en-us/library/aa752641%28v=vs.85%29.aspx
like image 26
paulsm4 Avatar answered Nov 09 '22 23:11

paulsm4


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.

like image 34
Melb Avatar answered Nov 10 '22 00:11

Melb