Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

ATL ACTIVEX SERVER COMPONENT

I need to build an ActiveX Server component for sendind email messages. I'
ve built a client object(Internet Explorer Object) to test my code and it
worked. The problems started when I copied the code to my server component
(ATL ActiveX Server component). This component has one method, Send(), and
the code is the following:

#import <cdo.dll> //comes with outlook2000 or you can get it
//at microsoft.com

STDMETHODIMP CMAIL::Send()
{
try
{
/* HRESULT hr;
MAPI::_SessionPtr session;
pSession.CreateInstance("MAPI.Session");
session->Logon(L"Luis Abreu");

// Create pointer to the Outbox Folder
MAPI::FolderPtr folder = session->Outbox;

// Create pointer to the Messages Collection
MAPI::MessagesPtr messages = folder->Messages;

// Create pointer to a new Message
MAPI::MessagePtr message = messages->Add();

// Set the Subject of the message
message->Subject = "Test";

// Set the Text of the message
message->Text = "This is an email test!";

// Create pointer to Recipients Collection
MAPI::RecipientsPtr recipients = message->Recipients;

// Create pointer to a new Recipient
MAPI::RecipientPtr recipient = recipients->Add();

// Set properties of the new recipient
recipient->Name = "luisabreu@netmadeira.com";
recipient->Type = 1L;

// Resolve the recipient address
recipient->Resolve();

// Send the message
message->Send(false,false);

// Logoff of the MAPI Session
session->Logoff();*/
}
catch ( _com_error& e )
{
AtlTrace( _T("Code = %08lx (%s)\n"), e.Error(), e.ErrorMessage() );
}
return S_OK;
}
I've tried debugging this component, but I can't. The procedure I've followed
to do the debugging was the following:

1. Load the ASP Page in IE5.0
2. Start VC++ and choose Debug->Attach to process from the build menu
3. Select the option show all system processes
4. Choose inetinfo
5. Open the file which contains the source code
6. Put BREAKPOINTS: here's the problem->I can't put breakpoints. It is as
if the file I open isn't the correct one!

Before writing the component, I've looked in MSDN and found some code for
using collaboration data objects(CDO) which is similar to the one I wrote.

Please HELP ME
Thanks
[2520 byte] By [Luis Abreu] at [2007-11-10 12:52:08]