Solved by getting Outlook using Explorer. Cannot get mail using previous way
IDispatch *pDispatch = pDispParams->rgvarg[0].pdispVal
case 0x0000fba7:
if(pDispParams->cArgs <= 0)
return E_INVALIDARG;
else
{
Outlook::_ApplicationPtr spApp("Outlook.Application");
Outlook::_MailItemPtr spMailItem;
IDispatch *pDispatch;
HRESULT hr;
long lll;
variant_t vvv = 1;
if (NULL == spApp)
{
hr = spApp.CreateInstance("Outlook.Application");
}
if (spApp)
{
Outlook::_ExplorerPtr spExplorer;
hr = spApp->ActiveExplorer(&spExplorer);
if (spExplorer)
{
Outlook::SelectionPtr spSel;
hr = spExplorer->get_Selection(&spSel);
hr = spSel->get_Count(&lll);
if (spSel && lll == 1) {
hr = spSel->Item(vvv, &pDispatch);
pDispatch->QueryInterface(__uuidof(_MailItemPtr), (void**)&spMailItem);
BSTR bbb;
hr = spMailItem->get_Body(&bbb); }
}
}
}
break;