S
Sukhvinder Lamba via OfficeKB.com
I'm writing an Outlook Addin. The expected functionality of Addin is such
that it adds a toolbar and button to my Outlook 2003. On clicking that
button it pops up a dialog, say Dialog1.
Dialog1 has an Text field and a submit button. I add some text to that text
fiels and on clicking of submit button, i expect new mail to be created and
the text in the text filed be added to the mail as message and that mail be
send to any pre-defined user.
I used the following code, but it throws access violation and causes
Outlook to crash.
CComPtr <Outlook::_MailItemPtr> mail;
m_spApp->CreateItem(olMailItem, (IDispatch**) &mail);
(*mail)->put_Subject( showFCNDialog.m_strSubject);
(*mail)->put_Body(showFCNDialog.m_strMessage);
(*mail)->put_To(showFCNDialog.m_strRecipient);
(*mail)->Send();
Can someone suggest whats wrong here.
Please copy your reply to (ss_lamba AT sify DOT com)
that it adds a toolbar and button to my Outlook 2003. On clicking that
button it pops up a dialog, say Dialog1.
Dialog1 has an Text field and a submit button. I add some text to that text
fiels and on clicking of submit button, i expect new mail to be created and
the text in the text filed be added to the mail as message and that mail be
send to any pre-defined user.
I used the following code, but it throws access violation and causes
Outlook to crash.
CComPtr <Outlook::_MailItemPtr> mail;
m_spApp->CreateItem(olMailItem, (IDispatch**) &mail);
(*mail)->put_Subject( showFCNDialog.m_strSubject);
(*mail)->put_Body(showFCNDialog.m_strMessage);
(*mail)->put_To(showFCNDialog.m_strRecipient);
(*mail)->Send();
Can someone suggest whats wrong here.
Please copy your reply to (ss_lamba AT sify DOT com)