Here is ther code, which i am written in "itemsend" event .
CComPtr<Outlook::_Application>m_applicant(m_spApp);
CComPtr<Outlook::_Inspector>m_inspect;
HRESULT hr;
IDispatch *Pdisp;
IHTMLDocument2Ptr htmdocument=NULL;
IHTMLElement *htmelement;
BSTR m_bstr;
char ks[20000];
int net_lenght;
hr= m_applicant->ActiveInspector(&m_inspect);
if(FAILED(hr))
MessageBox(NULL,_T("This is not active inspector object"),_T("Current
Inspector"),MB_OK);
/*
else
MessageBox(NULL,_T("This is active inspector object"),_T("Current
Inspector"),MB_OK);
*/
hr=m_inspect->get_HTMLEditor(&Pdisp);
if(FAILED(hr))
MessageBox(NULL,_T("HTML Editor object is not
creating"),_T("Simleys"),MB_OK);
hr=Pdisp->QueryInterface(IID_IHTMLDocument2,(void**)&htmdocument);
if(FAILED(hr)||(htmdocument==NULL))
{
MessageBox(NULL,_T("IHTMLDocument Object is not
creating"),_T("Smileys"),MB_OK);
}
/*
else
MessageBox(NULL,_T("IHTMLDocument Object is not
creating"),_T("Smileys"),MB_OK);
*/
hr=htmdocument->get_body(&htmelement);
if(FAILED(hr))
{
MessageBox(NULL,_T("The htmelement is not intiated"),_T("Smileys"),MB_OK);
}
htmelement->get_innerHTML(&m_bstr);
net_lenght=WideCharToMultiByte(CP_ACP,0,m_bstr,-1,NULL,0,NULL,NULL);
WideCharToMultiByte(CP_ACP,0,m_bstr,-1,ks,net_lenght+1,NULL,NULL);
strcat(ks,"Here is text wiill be added");
net_lenght=sizeof(ks);
MultiByteToWideChar(CP_ACP,NULL,ks,-1,m_bstr,net_lenght+1);
htmdocument->put_designMode(CComBSTR("On"));
hr=htmelement->put_innerHTML(m_bstr);
if(hr==S_OK)
MessageBox(NULL,_T("Here text Added"),_T("Smileys"),MB_OK);
else
MessageBox(NULL,_T("text is not added"),_T("Smileys"),MB_OK);
htmdocument->put_designMode(CComBSTR("Off"));
Plz suggest me any solution
--
Regards,
RamakoteswaraRao Koti
Dmitry Streblechenko said:
Please show the relevant snippets of your code.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool