COMMAIL: Demonstrates an Automation Client Application with Compiler COM Support

Click to open or copy the COMMAIL project files.

COMMAIL is a stand-alone Automation (formerly OLE Automation) client. It automates MAPI for Microsoft Exchange 4.0 (or later) or Microsoft Outlook. This sample sends an e-mail, which contains its source code, to a specified e-mail recipient. In order to run this sample, you must do the following:

  1. Modify paths in the source code by following the instructions given in the //To DO lines.

  2. Change the recipient e-mail name and other e-mail parameters.  Search the source code for #pragma for instructions on what you have to modify.

Look at the type library header files (.tlh and .tli). Compare the COM interfaces in the header files with interfaces of the same type library displayed by OLEVIEW.

There is a Visual Basic project that controls the server in a way analogous to the COM code in Visual C++. You can compare the Visual Basic code with the code of this sample to see the similarities. You can use Visual Basic-specific object model documentation to write COM controllers in Visual C++. In fact, this is how this sample was written.

This sample demonstrates the following keywords:

dispinterface; #import; _com_ptr_t; _variant_t; _bstr_t; _com_error.

See also Compiler COM Support.