This documentation is archived and is not being maintained.

COMMAIL Sample: Demonstrates an Automation Client Application with Compiler COM Support

COMMAIL is a standalone Automation client. It automates MAPI for Microsoft Exchange 4.0 (or later) or Microsoft Outlook. This sample sends an e-mail message which contains its source code to a specified e-mail recipient.

Building and Running the Sample

To build this sample with Microsoft Office XP, be sure that the macro OfficeXP is defined in your code as follows: #define OFFICEXP 1.

To build and run this sample

  1. Open the solution commail.sln.
  2. Modify paths and file names in the source code by following the instructions given in the //To DO lines in commail.cpp.
  3. Change the recipient e-mail name and other e-mail parameters. Search the source code for #pragma for instructions on what you need to modify.
  4. Add the directory path to olemsg32.dll (Office 97) or cdo.dll (Office 2000 and Office XP). You can add this file to your Include files path in the VC++ Directories dialog box.
  5. On the Build menu, click Build.
  6. On the Debug menu, click Start Without Debugging.

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.


This sample demonstrates the following keywords:

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

See Also

Compiler COM Support Samples | Compiler COM Support