Visual Studio

Mastering COM Development Using Microsoft Visual C++ (Classroom View)
(Microsoft Training Course: 1012) - 5 days - £2640 exc VAT

> Target Audience
This course will teach developers who use the Microsoft Visual C++ development system how to create component object model (COM) objects using Visual C++ and the Active Template Library (ATL).
This course has now been replaced by Course 1304: Component Development using the Active Template Library 3.0.
> Course outline
  1. Introduction to COM
  2. Creating a Client of a COM Object
  3. Creating a COM Object
  4. Implementing Multiple Interfaces
  5. Introduction to the Active Template Library
  6. Automation
  7. Dual Interfaces
  8. Adding Events
  9. Creating an ActiveX Control
  10. Object Reuse in COM
  11. Custom Interfaces
  12. Threading Models
  13. Collections

Supplementary InformationThis course has now retired and is no longer available. We suggest you look at Course [[{http://www.F1Comp.Co.UK/computer_training/Microsoft_Training_Courses/Visual-Studio-.Net/2124.aspx}2124: Programming with C#.]]
Module 1: Introduction to COM
  • Issues surrounding software development that the Component Object Model attempts to address.
  • List and explain the problems that confront component software developers today.
  • List and explain attempted solutions to traditional component software development.
  • Explain the drawbacks of various solutions to component software development.
  • List the solutions that COM provides for component software development problems.
Module 2: Creating a Client of a COM Object
  • Creating a COM object client using C++
  • Lab: Registering a COM object
  • Lab: Creating a client of a COM object
  • Explain how COM uses strings.
  • Write code to initialize and uninitialize COM services.
  • Explain CLSIDs, ProgIDs, their use in the registry, and how COM system services and client applications use them.
  • Write code that creates and uses a simple COM object.
Module 3: Creating a COM Object
  • Fundamentals of COM
  • Creating a simple COM object
  • Lab: Creating a simple COM object
  • Lab: Writing code that creates and uses a simple COM object
  • Lab: Coding the WinMain function for an out-of-process COM object server
  • Lab: Writing a registry file
  • Explain the concept of immutability in relation to interfaces.
  • Describe the purpose of the IUnknown interface.
  • List and describe the three methods of the IUnknown interface.
  • Explain reference counting and its implications.
  • Explain, generate, and use a globally unique identifier (GUID).
  • Derive a C++ class from an interface and implement all required methods.
  • Create a class factory for a COM object.
  • Explain the difference between a COM object and a COM object server.
  • Write code for the WinMain function of a simple COM object.
  • Register a COM object.
  • Add code to the registry functions for COM to support self-registration.
  • Create a registry (.reg) file and manually register an object.
Module 4: Implementing Multiple Interfaces
  • Techniques to implement COM objects with multiple interfaces
  • Lab: Adding an interface to an object by using multiple inheritance
  • Lab: Modifying IUnknown::QueryInterface to reflect added interfaces
  • Lab: Calling QueryInterface in a client application to obtain additional interfaces
  • Use multiple inheritance to add a second interface manually to a simple COM object.
  • Add code for a second interface to the QueryInterface method.
  • Create a client that will use a COM object that has multiple interfaces.
  • Explain the VTBL layout of a COM object that supports multiple inheritance.
Module 5: Introduction to the Active Template Library
  • Structure, primary features, and basic use of the Active Template Library in creating COM components
  • Using the Visual C++ extensions to create a client of a COM object
  • Lab: Using ATL COM AppWizard to create the shell for a COM object
  • Lab: Using ATL Object Wizard to add a simple COM object to the ATL project
  • Lab: Manually adding existing interfaces to the COM object server
  • Lab: Using C++ extensions and smart pointers to create a COM object client application
  • Use ATL COM AppWizard to create a COM object server.
  • Use ATL Object Wizard to add a simple COM object with a custom interface to an ATL COM project.
  • Use Visual C++ extensions to facilitate writing a COM client application.
  • Manually add an interface to an ATL COM project.
  • Describe the following items in an ATL COM project: COM map, Object map, CComModule, CComObjectRoot, and CComCoClass.
Module 6: Automation
  • Creating COM components that support automation
  • Using IDispatch to implement automation
  • Dispinterfaces
  • Early and late binding
  • Interface Definition Language (IDL) basics
  • Lab: Using OLE/COM Object Viewer to locate and browse type libraries
  • Lab: Defining properties and methods in IDL for a dispinterface
  • Lab: Using the MIDL compiler to compile IDL into type libraries
  • Add properties and methods to a COM object.
  • Identify which data types can be passed with automation.
  • Create a type library.
Module 7: Dual Interfaces
  • Improving efficiency of automation interfaces by turning them into dual interfaces
  • Lab: Creating an ActiveX technology component that supports automation using the ATL wizards
  • Explain the difference between dispinterfaces, custom interfaces, and dual interfaces.
  • Define a dual interface, with its properties and methods, in Interface Definition Language.
  • Explain the benefits and limitations of dual interfaces.
  • Create a dual interface with the ATL.
Module 8: Adding Events
  • Using ATL classes to add events to a COM object and to an MFC client of the COM object
  • Lab: Creating a COM object that fires an event
  • Lab: Creating a client that receives an event fired by a COM object
  • Add event firing to an ATL-generated COM object.
  • Add an event-handling interface to a MFC-built COM client.
  • Explain how events work in COM from a server and client perspective.
Module 9: Creating an ActiveX Control
  • Creating an ActiveX control using ATL
  • Basic parts of ATL used to make an ActiveX control work, such as the message map and the OnPaint method
  • Different property types, such as ambient properties and stock properties
  • Creating a property page
  • Lab: Creating an ActiveX control with ATL Object Wizard
  • Lab: Adding a stock property, custom property, custom method, and custom event
  • Lab: Reusing an existing window class
  • Create a control with ATL.
  • Modify the OnDraw method to draw graphical output for a control.
  • Create a property page.
  • Read ambient properties.
Module 10: Object Reuse in COM
  • Reusing objects in COM through containment and aggregation
  • Differences between inheritance and aggregation
  • Differences between implementation inheritance and interface inheritance
  • Reuse through COM containment
  • Reuse through COM aggregation
  • Creating an aggregated object using ATL
  • Lab: Using ATL to create a COM object that can be aggregated
  • Lab: Using ATL to create a COM object that aggregates another COM object
  • Explain the difference between implementation inheritance and interface inheritance.
  • Explain the difference between COM containment and COM aggregation.
  • Create an aggregated object with ATL.
Module 11: Custom Interfaces
  • Creating and marshaling custom interfaces
  • Creating a proxy/stub dynamic-link library (DLL) to marshal a custom interface
  • How the standard marshaling architecture works in COM
  • Lab: Creating a custom interface with ATL
  • Lab: Creating a proxy/stub DLL for a custom interface
  • Lab: Using the default allocator in COM to allocate and free memory dynamically
  • Lab: Writing IDL syntax to pass arrays efficiently
  • Explain why custom interfaces are necessary.
  • Create a custom interface in ATL that works across process boundaries.
  • Describe the process used by a proxy/ stub DLL to marshal data types.
  • Explain why marshaling creates memory management and distribution issues.
  • Create a proxy/stub DLL using ATL.
Module 12: Threading Models
  • COM threading models
  • How mixed threading models with in-process and out-of-process clients and servers can cause marshaling issues
  • Lab: Identify which threading model combinations are most efficient, and which are the least efficient
  • Lab: Identify which threads can be called from a client to a server with different threading model scenarios
  • Explain the differences between single-threaded applications, single-threaded apartment models, and multithreaded apartment models.
  • Explain how mixing threading models with in-process and out-of-process servers can cause marshaling issues.
  • Identify the registry keys for threading models.
Module 13: Collections
  • Creating and using enumerator components to create an object model
  • Creating an object model consisting of both public and private objects via COM services or some internal creation method
  • Lab: Creating a collection that contains COM objects
  • Lab: Creating a client that uses a collection
  • Add single and multilevel property collections to an ATL-built COM object.
  • Write client-side code in C++ for iterating over collections.
  • Create and use enumerator objects.
> Pre-Requisites
Before attending this course, students should have the following pre-requisites:
  • Describe and use the following C++ fundamentals: constructors and destructors; virtual functions; conversion functions; function overloading; operator overloading; accessors; single and multiple inheritance; templates.
  • Use the Microsoft Windows operating system and the Visual Studio development system.
> Purpose
At the end of this course, students will be able to build clients of COM objects; build COM object servers; create ActiveX controls; use Visual C++ extensions to create clients of COM objects; build COM objects that reuse existing COM objects; add events to COM objects and clients; create COM objects with dual interfaces.
> Supplementary Information
This course has now retired and is no longer available. We suggest you look at Course [[{http://www.F1Comp.Co.UK/computer_training/Microsoft_Training_Courses/Visual-Studio-.Net/2124.aspx}2124: Programming with C#.]]