M
MikeJohnson
Here is my Outlook Object model code:
int iNumAttachments = pAttachments->GetCount();
for (int i = 1; i <= iNumAttachments; i++)
{
Attachment* pAttachment = pAttachments->Item(i);
if (pAttachment)
{
string strAttachment = GetAttachmentName (pAttachment);
_bstr_t bstrAttachment = strAttachment.c_str();
HRESULT hr = pAttachment->SaveAsFile (bstrAttachment);
}
}
This code always crashes in SaveAsFile, apparently on the same
attachment, after saving several attachments successfully!
The crashing object must be messed up-
When I examine it's interface table with the debugger:
pAttachment
IDispatch
IUnknown
__vfptr[0] = 0x00000000
The underlying IUnknown of this object looks bad.
Any thoughts?
Is my code clean?
Thanks!
-Mike
int iNumAttachments = pAttachments->GetCount();
for (int i = 1; i <= iNumAttachments; i++)
{
Attachment* pAttachment = pAttachments->Item(i);
if (pAttachment)
{
string strAttachment = GetAttachmentName (pAttachment);
_bstr_t bstrAttachment = strAttachment.c_str();
HRESULT hr = pAttachment->SaveAsFile (bstrAttachment);
}
}
This code always crashes in SaveAsFile, apparently on the same
attachment, after saving several attachments successfully!
The crashing object must be messed up-
When I examine it's interface table with the debugger:
pAttachment
IDispatch
IUnknown
__vfptr[0] = 0x00000000
The underlying IUnknown of this object looks bad.
Any thoughts?
Is my code clean?
Thanks!
-Mike