D
Dkds.Naidu
Hi,
I am trying to get the currently selected item in the outlook folder.
I tried with the below code snippet. I got memory problems.
where is the problem?
void __stdcall COutlook::OnContextMenuUpdat()
{
CComQIPtr<Outlook::_Application> spApp(m_spApp);
CComPtr<Outlook::_Explorer> olExplorer;
olExplorer = spApp->ActiveExplorer();
CComPtr<Outlook::Selection> OLSelection;
olExplorer->get_Selection(&OLSelection);
if (OLSelection)
{
long count;
OLSelection->get_Count(&count);
LPDISPATCH lpDisp = NULL;
VARIANT var;
var.lVal = count;
lpDisp = OLSelection->Item(count);
if (lpDisp)
{
CComQIPtr<Outlook::_MailItem> mailItem(lpDisp);
BSTR bstr;
mailItem->get_Body(&bstr);//here I got memory problems. why?
}
}
}//end of function
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
I am trying to get the currently selected item in the outlook folder.
I tried with the below code snippet. I got memory problems.
where is the problem?
void __stdcall COutlook::OnContextMenuUpdat()
{
CComQIPtr<Outlook::_Application> spApp(m_spApp);
CComPtr<Outlook::_Explorer> olExplorer;
olExplorer = spApp->ActiveExplorer();
CComPtr<Outlook::Selection> OLSelection;
olExplorer->get_Selection(&OLSelection);
if (OLSelection)
{
long count;
OLSelection->get_Count(&count);
LPDISPATCH lpDisp = NULL;
VARIANT var;
var.lVal = count;
lpDisp = OLSelection->Item(count);
if (lpDisp)
{
CComQIPtr<Outlook::_MailItem> mailItem(lpDisp);
BSTR bstr;
mailItem->get_Body(&bstr);//here I got memory problems. why?
}
}
}//end of function
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.