?
=?ks_c_5601-1987?B?wLHH/LW/?=
First of all, thank you very much for Ken Slovak...
But I have another question....
I succeeded in getting the mail address from Addin thanks to Ken Slovak using
MailItem.BeforeCheckNames.
But I got another problem.
When I access mail address that was from Addin, I got the warning box,
saying "A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this?".
"If this is unexpected, it may be a virus and you should choose "No"."
Can I skip this one?
I'm curious whether there's a way the user can set up the option (of the OutLook).
Below is the routine that takes the mail address from Outlook.
(I have coded it with VC++ 6.0 and removed the exception routines.)
The first code causes one alert message box, and the second code causes (email address + 1 ) message boxes...
First code.
void __stdcall COutHMail::OnBeforeCheckNames(BOOL* Cancel)
{
::AfxMessageBox("Check Name");
LPDISPATCH pDisp = NULL;
pDisp = m_pApp->ActiveInspector();
CComQIPtr<Outlook::_Inspector> pInsp(pDisp);
pDisp->Release();
pDisp = NULL;
pDisp = pInsp->GetCurrentItem();
CComQIPtr <Outlook::_MailItem> pItem(pDisp);
pDisp->Release();
pDisp=NULL;
CString strName = pItem->GetTo();
::AfxMessageBox(strName);
pItem.Release();
}
Second code.
void __stdcall COutHMail::OnBeforeCheckNames(BOOL* Cancel)
{
LPDISPATCH pDisp = NULL;
pDisp = m_pApp->ActiveInspector();
CComQIPtr<Outlook::_Inspector> pInsp(pDisp);
pDisp->Release();
pDisp = NULL;
pDisp = pInsp->GetCurrentItem();
CComQIPtr <Outlook::_MailItem> pItem(pDisp);
pDisp->Release();
pDisp=NULL;
CComQIPtr <Outlook::Recipients> pRecips = pItem->GetRecipients();
long lCount = pRecips->GetCount();
for(long for_count = 0; for_count < lCount; for_count++)
{
CComVariant pVal(for_count+1);
CComPtr<Outlook::Recipient> pRecip = pRecips->Item(pVal);
CString strName = pRecip->GetName();
::AfxMessageBox(strName);
}
pItem.Release();
}
But I have another question....
I succeeded in getting the mail address from Addin thanks to Ken Slovak using
MailItem.BeforeCheckNames.
But I got another problem.
When I access mail address that was from Addin, I got the warning box,
saying "A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this?".
"If this is unexpected, it may be a virus and you should choose "No"."
Can I skip this one?
I'm curious whether there's a way the user can set up the option (of the OutLook).
Below is the routine that takes the mail address from Outlook.
(I have coded it with VC++ 6.0 and removed the exception routines.)
The first code causes one alert message box, and the second code causes (email address + 1 ) message boxes...
First code.
void __stdcall COutHMail::OnBeforeCheckNames(BOOL* Cancel)
{
::AfxMessageBox("Check Name");
LPDISPATCH pDisp = NULL;
pDisp = m_pApp->ActiveInspector();
CComQIPtr<Outlook::_Inspector> pInsp(pDisp);
pDisp->Release();
pDisp = NULL;
pDisp = pInsp->GetCurrentItem();
CComQIPtr <Outlook::_MailItem> pItem(pDisp);
pDisp->Release();
pDisp=NULL;
CString strName = pItem->GetTo();
::AfxMessageBox(strName);
pItem.Release();
}
Second code.
void __stdcall COutHMail::OnBeforeCheckNames(BOOL* Cancel)
{
LPDISPATCH pDisp = NULL;
pDisp = m_pApp->ActiveInspector();
CComQIPtr<Outlook::_Inspector> pInsp(pDisp);
pDisp->Release();
pDisp = NULL;
pDisp = pInsp->GetCurrentItem();
CComQIPtr <Outlook::_MailItem> pItem(pDisp);
pDisp->Release();
pDisp=NULL;
CComQIPtr <Outlook::Recipients> pRecips = pItem->GetRecipients();
long lCount = pRecips->GetCount();
for(long for_count = 0; for_count < lCount; for_count++)
{
CComVariant pVal(for_count+1);
CComPtr<Outlook::Recipient> pRecip = pRecips->Item(pVal);
CString strName = pRecip->GetName();
::AfxMessageBox(strName);
}
pItem.Release();
}