Visual C++ 6 Unleashed

Visual C++ 6 Unleashed

By MICKEY WILLIAMS and David Bennett

Summary

This chapter introduced you to some of the issues involved in creating custom COM objects using the Active Template Library. This chapter discussed the different options for passing pointers to and from COM objects. Also discussed were how complex data types, such as structures, enumerations, and unions can be declared and used in IDL. Proper declaration of pointers, structures, and other types is essential if you want to be able to efficiently use your COM objects with a wide variety of programming tools.

You looked at an example of a custom COM object being created, along with a sample client that tests the COM object. This custom COM object used enumerations and structures in its interface, and demonstrated how complex types can be sent through a COM interface.

Using complex types, as was done in the OsVersionInfo project, is useful when large amounts of data must be passed through a COM interface. Rather than passing hard-coded flags, it's more flexible to use enumerations. Rather than passing large numbers of parameters, it's often more efficient to pass a structure.

Share ThisShare This

Informit Network