I didn't try, and don't know if this would be a solution.
Just an idea.
pIBodyPart->Release();
pIBodyPart = NULL;
m_pIMessage->Release();
m_pIMessage = NULL;
p.s.
Where are you from, alex?
We Korean C++Builder developers welcome you, regardless of your country. :)
alex 님이 쓰신 글 :
: Actullay, the file is created on temp folder.
: But i still cannot delete.
:
: Thanks
:
:
: nicekr.황경록 님이 쓰신 글 :
: : i don't know about CDO and M$ Exchange Server & Client application.
: : if problem is file locking that use AddAttachment, how about use temporary file name?
: : generate the temporary file name every time, it is a one of solution that i think.
: :
: : alex 님이 쓰신 글 :
: : : 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();
: : :
: : : }
: : : }
|