Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top