Your Windows 95 application must include a Send Mail command on its File menu. The MFC library supplies an implementation of the Send Mail command in the form of two member functions of the CDocument class: OnFileSendMail and OnUpdateFileSendMail.
The OnFileSendMail member function saves the current document as an attachment to a mail message, and then invokes the mail client installed on the user’s machine; the mail client allows the user to address the mail, add text, and then send the message. The OnUpdateFileSendMail member function enables or disables the Send Mail command depending on whether MAPI support is present on the user’s machine.
Binding these functions to a menu item in DRAWCLI involves the following modifications to the source files:
CDrawDoc
:
ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail)
ON_UPDATE_COMMAND_UI(ID_FILE_SEND_MAIL, OnUpdateFileSendMail)
These macros go outside of the special //{{AFX
delimiter comments because they’re entered manually instead of through ClassWizard.
There’s no need to override these functions; their definitions in the base class are invoked if the derived class doesn’t provide new ones. For CDrawDoc
, the COleDocument definitions of these functions get invoked. For a non-OLE document class, the CDocument definitions of these functions get invoked.
If you’re creating a new MFC application, you can have AppWizard add the entries listed above by checking the Add MAPI Support check box.
For more information, see the article MAPI Support in MFC.