Redemption Compiler problem

B

Byron

I'm not well versed enough in COM to troubleshoot this problem. Any
help or suggestions will be greatly appreciated. TIA.

I am trying to use Redemption but I'm having trouble getting past a
compiler error. The error is:

c:\.......\OlSmPlug-In\ItemEventHandler.cpp(882): error C2079:
'sMailItem' uses undefined struct 'Redemption::SafeMailItem'.

Here is the simple decleration in my code in ItemEventHandler.cpp
(882)

Redemption::SafeMailItem sMailItem;

I ran the installer file you provide as part of the Redemption
download. Redemption does show up in Outlook's Add-In Manager and
it's checked. Here is my import statement and my SafeMailItem
decleration. #import "C:\\Program Files\\Redemption\\Redemption.dll"
The import statement is in the same header file as the office
mso.dll. I have no problem importing the Office/Outlook files.

The redemption.tlh and redemption.tli files are created in my Debug
directory. SafeMailItem is declared in the tlh file.

Here is my system info:

Window XP Pro

MS Visual Studio 2003 version7.1.6030

Outlook 2002 SP3 version 10.6838.6845

Redemption 4.6.0.924
 
C

cainrandom

I'm not well versed enough in COM to troubleshoot this problem.  Any
help or suggestions will be greatly appreciated.  TIA.

I am trying to use Redemption but I'm having trouble getting past a
compiler error.  The error is:

 c:\.......\OlSmPlug-In\ItemEventHandler.cpp(882): error C2079:
'sMailItem' uses undefined struct 'Redemption::SafeMailItem'.

Here is the simple decleration in my code in ItemEventHandler.cpp
(882)

Redemption::SafeMailItem sMailItem;

I ran the installer file you provide as part of the Redemption
download.  Redemption does show up in Outlook's Add-In Manager and
it's checked.  Here is my import statement and my SafeMailItem
decleration.  #import "C:\\Program Files\\Redemption\\Redemption.dll"
The import statement is in the same header file as the office
mso.dll.  I have no problem importing the Office/Outlook files.

The redemption.tlh and redemption.tli files are created in my Debug
directory.  SafeMailItem is declared in the tlh file.

Here is my system info:

Window XP Pro

MS Visual Studio 2003 version7.1.6030

Outlook 2002 SP3 version 10.6838.6845

Redemption 4.6.0.924

You have to create an instance of the Redemption SafeMailItem and
initialize it. Are you using ATL?
 
B

Byron

I'm not using ATL.




You have to create an instance of the Redemption SafeMailItem and
initialize it.  Are you using ATL?- Hide quoted text -

- Show quoted text -
 
B

Byron

I do specify using namespace Redemption; following the import line.
#import "C:\\Program Files\\Redemption\\Redemption.dll" named_guids
using namespace Redemption;

I can compile now but I can't assign an Outlook::_MailItemPtr to
Redemption::ISafeMailItemPtr.

void CMailItemHandler::InlineImage(Outlook::_MailItemPtr mailPtr) //
(mailPtr obtained by calling Outlook::_InspectorPtr->GetCurrentItem())
{
Redemption::ISafeMailItemPtr pSMItem;
pSMItem = mailPtr; // pSMItem is NULL, stepping into the COM
code E_NOINTERFACE was returned somewhere in QueryInterface code

// I have also tried the following variations and the compiler
squaked at me for the assignments.
CComPtr<Redemption::ISafeMailItem> spSMItem;
Redemption::ISafeMailItem* pISMItem = NULL;

spSMItem = mailPtr;
pISMItem = mailPtr;
}

Thanks for the help!
 
D

Dmitry Streblechenko

Of course you can't, these are two different objects - you need to create an
instance of the Redemption.SafeMailItem object, then set its *em* property
to an instance of the Outlook.MailItem object.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-

I do specify using namespace Redemption; following the import line.
#import "C:\\Program Files\\Redemption\\Redemption.dll" named_guids
using namespace Redemption;

I can compile now but I can't assign an Outlook::_MailItemPtr to
Redemption::ISafeMailItemPtr.

void CMailItemHandler::InlineImage(Outlook::_MailItemPtr mailPtr) //
(mailPtr obtained by calling Outlook::_InspectorPtr->GetCurrentItem())
{
Redemption::ISafeMailItemPtr pSMItem;
pSMItem = mailPtr; // pSMItem is NULL, stepping into the COM
code E_NOINTERFACE was returned somewhere in QueryInterface code

// I have also tried the following variations and the compiler
squaked at me for the assignments.
CComPtr<Redemption::ISafeMailItem> spSMItem;
Redemption::ISafeMailItem* pISMItem = NULL;

spSMItem = mailPtr;
pISMItem = mailPtr;
}

Thanks for the help!
 
B

Byron

Got it. I figured it out. Thanks for the help Dmitry and Cain T. S.
Random. Here is my solution:

Redemption::ISafeMailItemPtr pSMItem;
pSMItem.CreateInstance(__uuidof(SafeMailItem));
pSMItem->PutItem(mailPtr);
pSMItem->PutBody(_T("HELLO!!???")); //Succesfully modifies the
message body.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top