How do I email my serialized CDocument-derived object as an email attachment ? I read OnFileSendMail() is supposed to do so, but it fails on the following line in docmapi.cpp (implementing CDocument::OnFileSendMail()):
int nError = lpfnSendMail(0, (ULONG)pParentWnd->GetSafeHwnd(),&message, MAPI_LOGON_UI|MAPI_DIALOG, 0);
witn nError=2. I am getting messages like:
"The form required to view this message cannot be displayed"(From Microsoft Exchange),
"Send mail failed to send message" (from my app).
My VC code really does very little: I use default implementation for OnFileSendMail, and never change the modified flag for the document. So OnFileSendMail simply takes the original file from where the document was opened, and does not call any SaveDocument() functions.
For email, I am using MS Outlook.