An advanced
knowledge of the Microsoft Foundation Classes is required to build applications
and tools that are compliant with Microsoft's COM, or Common Object Model,
cross-platform paradigm. Since virtually all modern commercial applications and
tools are COM-compliant, it is essential that the programmer learns these
techniques as soon as possible.
4-5 days. This course may be presented in four days, or with more in-depth coverage in five days.
Working with User Interfaces
The course begins with a review of MFC covered in the Introduction to MFC, by re-creating the Shapes application—but adding the App Wizard options to make the application serve additionally as an ActiveX Client and Server.
- A COM overview
- Compound documents
- Linking vs. Embedding
- Importing existing code into an MFC project
- Interfacing to the System Registry
- Supporting persistent frame positions
- Using the COM document class' built-in container
- Using MFC's non-standard Run-time Type Identification
- Selecting on-screen objects: the CRectTracker class
- Enhancing the tracker with CSelection and CSelectable classes
- Where is the mouse? Hit tests
Working with Compound Document Servers
In this chapter, the basic Shapes application's server code is filled in, enabling Shapes documents to be embedded in ActiveX clients such as Microsoft Word and Microsoft Excel.
- Registration database
- GUIDs
- The COleServerItem class
- Drawing aspects
- Updating COM items vs. updating views
- Working with menu negotiation: Server side
Working with Compound Containers
In this chapter, the basic Shapes application's client code is filled in, allowing Shapes documents to include embedded or linked components from ActiveX servers such as Microsoft Word and Microsoft Excel.
- The COleClientItem class
- COleDocument class quirks
- Drawing, hit-testing and measuring data points and embedded COM objects
- Creating an OLE object
- In-place activation and editing
Working with the Clipboard
COM technology has enhanced clipboard access, making the Windows Clipboard much more powerful, yet, in some ways, trickier to use. This chapter explains it all.
- OLE vs. "flat" clipboard access
- The COleClientItem - clipboard connection
- The COleDataSource and COleDataObject classes
- Standard clipboard formats
- Custom clipboard formats
- Why and how to use the "native" format
- Implementing the Edit menu's clipboard commands
Working with Automation
OLE automation provides a means to control an application programmatically, without having to embed an object from that application in the client's data. This chapter explains how it works and how to implement it.
- The IDispatch interface
- Type libraries and dispatch maps
- Exposing properties and methods
Working with ActiveX Controls
In this chapter, the class creates a custom, ActiveX control, and then uses it in the Shapes application.
- A brief history of component software
- Using the Control Wizard
- The stock properties and methods
- Designing and implementing property pages
- Stock and custom events
- Using the new control in an MFC application
- Demo: Using the new control in a Visual Basic application
Working with Threads and Multi-Tasking
This chapter takes a look at the concept of multi-threading and the tools MFC provides to implement multi-threading in a Windows application. (Not part of the four-day version of this class.)
- Concept of multi-threading
- Worker threads vs. user-interface threads
- Thread contexts and scheduling
- The CWinThread class and functions
- Inter-thread communication
- MFC thread/object dangers
- Thread priorities
- Thread synchronization objects
- Critical sections