Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

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.

Security noteSecurity Note:

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To get samples and instructions for installing them:

  • On the Visual Studio Help menu, click Samples.

    For more information, see Visual Studio Samples.

  • The most recent version and complete list of samples is available online from the Visual Studio 2008 Samples page.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied into a folder under \Program Files\Visual Studio 9.0\Samples\. For Express editions of Visual Studio, all samples are located online.

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.