Now that we have the user interface for the
OCRClient application, let’s learn the first technique to communicate with a distributed component: the COleDispatchDriver technique. This technique maps to the
TypeLib button of the
OCRClient dialog application.
Before we start, let’s first say a few things to recap what we know about type libraries. A type library is a binary file that contains detailed type information of COM classes that are supported by a piece of deployable code called a component. A type library is not a component; it simply contains metadata for interfaces and objects within a component. Although not a component, a type library can be bounded into a component similar to the way a resource can be bounded, so don’t be surprised to see type information in a DLL, an OCX, or an EXE.
Type libraries are built from IDL files by using the
library keyword. A type library typically contains, in a nutshell, a library that includes a number of COM classes, each of which may support a number of COM interfaces. In turn, each of these interfaces may have a number of properties and methods. The library, classes, and interfaces are all unique, because they are all tagged with a GUID.
Since type libraries store detailed type information for COM components, a simple tool can easily use type libraries to dynamically discover the definitions for all supported objects and interfaces. The
MFC ClassWizard, which is an integrated part of Visual C++, is capable ...