Using the ATL for Windows CE Wizards to Simplify Application Development

The Windows CE Toolkit for Visual C++ 5.0 provides two wizards for the Active Template Library for Windows CE. These are the WCE ATL COM AppWizard and the WCE ATL Object Wizard.

You use the WCE ATL COM AppWizard to create a new ATL project. Like the WCE MFC AppWizard, the WCE ATL COM AppWizard generates some of the generic code that's common to all ATL projects. It provides five global functions and a globally declared instance of CComModule.

The DllMain function is the dynamic link library (DLL) equivalent of WinMain. The DllRegisterServer and DllUnregisterServer functions register and unregister the server's components in the registry. Clients can call the DllGetClassObject function to obtain a pointer to the class factory for any component defined in the DLL. COM calls the DllCanUnloadNow function to determine when all objects managed by the DLL have a reference count of zero, so it can unload the DLL from memory. The CComModule object maintains information about all the objects managed by the server. There must be exactly one instance of CComModule in every ATL project.

The project generated by the WCE ATL COM AppWizard initially contains no COM components. After the project is created, you can use the Windows CE ATL Object Wizard to add components to it. The Windows CE ATL Object Wizard supports seven basic types of components. The components are derived from various templatized classes that provide default implementations of commonly used COM interfaces. The Windows CE ATL Object Wizard generates the necessary header file declarations, IDL definitions, and COM interface map entries for the components you add. You write the methods that implement the functionality that's specific to your components. You can also override the implementations of standard interface methods inherited from the ATL classes.