Interface Identity

Like objects and component classes, every interface must have a unique identity so that clients are always clear about the functionality and features they are accessing through the interface. In contrast to the four possible ways to identify a component, an interface is always identified precisely with an IID. Again, an IID is equivalent to the GUID and therefore shares the same characteristic uniqueness.

Of course, it would be painful to write code that identifies an interface with a bunch of hex digits. For this reason, IIDs are usually given a compile-time symbolic constant that works in place of the exact value, which is then used at run time. These symbols are named IID_<Interface>, as in IID_IConnectionPoint or IID_IUnknown. However, these symbols identify the interface but not the interface pointer type. Interface pointer variables are always declared using <Interface> *, as in IUnknown * or IStorage *. OLE also defines aliases for these types, for example LPSTORAGE, for which you drop the I and the *, add LP, and put the rest in uppercase. Outside the context of a pointer, interface names are never used programmatically but serve only for conversation. You will never see IUnknown by itself in code, always IUnknown *. We'll refer to an object's implementation of the interface as simply IUnknown. Of course, all of these names, types, and symbols only matter at compile time; the actual IID value is the sole interface identifier at run time.