The file("c:\\filename.txt" ) i used for attachment cannot delete until the application terminated..
Is there anyway i can delete it? Is it suppose to work this way???
Thanks in advance..
CDO::IBodyPart* pIBodyPart = NULL;
if ( SUCCEEDED( m_pIMessage->AddAttachment( L"c:\\filename.txt",L"",L"",&pIBodyPart )
{
hr = pIBodyPart->put_ContentMediaType( _bstr_t( "text/plain" ) );
std::string strDisposition ="attachment;filename=" ;
strDisposition += SZ_FILTERFILE ;
{
Field* pField = NULL;
Fields* pFields = NULL;
hr = pIBodyPart->get_Fields( &pFields );
// Disposition.
hr = pFields->get_Item( _variant_t( "urn:schemas:mailheader:content-disposition" ), &pField );
_bstr_t bstrDisposition( strDisposition.c_str() );
hr = pField->put_Value( _variant_t( bstrDisposition ) );
pField->Release();
pField= NULL;
hr = pFields->Update();
pFields->Release();
}
}
|