Platform: Windows Mobile 6
Application: Pocket Outlook (Messaging)
Program Description:
Created an Email Client in my application using Win32 API and MAPI. I'm able
to create and submit my message to Pocket Outlook, but the message resides in
the Outbox until the next synchronization (Send/Receive set @ 5 mins).
However, I need to send the email as soon as possible, and I've read about
COM objects such as IMailSyncCallBack, but I can't find any examples of how
to use this interface properly. A lot of the material that's on the Internet
is very limited, and it's hard to decipher. Maybe I'm confused on the concept
of custom transports (and honestly, I don't want to create one if I don't
have to), but isn't there a way to just use the default transport and
synchronize, without having to provide the implementation details for the
abstract class IMailSyncCallBack? Since MSDN states this as a COM interface,
this is what I've been trying to do, however to no avail:

Code:

CLSID clsid;
LPOLESTR pProgID = L"PocketOutlook.Application"; //Don't think this
is right..
hr = CLSIDFromProgID(pProgID, &clsid);

IMailSyncCallBack *pMSCB;

CoInitializeEx(NULL, COINIT_MULTITHREADED);

//Following Returns E_NOINTERFACE... Therefore, the CLSID is incorrect.
hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_HANDLER,
IID_IMailSyncCallBack, (void**) pMSCB);
if(SUCCEEDED(hr))
{
//pMSCB Methods go here
pMSCB->Release();
}
else
{
//Error!
MessageBox(hWnd, _T("Instance Failed!"), _T("Warning!"), MB_OK);
CoUninitialize();
return(-1);
}

Any help would be greatly appreciated.
-kvh
Was this post helpful to you?

Why should I rate a post?



Expand AllCollapse All

Re: IMailSyncCallBack/Pocket Outlook(Messaging) by Peter

Peter
Thu Feb 21 02:16:23 CST 2008

You can use the MailSyncMessages API to force a Send/Receive (Supported on
Windows Mobile 5.0 and above). See the SDK documentation for full details.

HRESULT r = MailSyncMessages(_T("YourAccount"), MCF_ACCOUNT_IS_NAME);


Peter

--
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility

"kvh" <kvh@discussions.microsoft.com> wrote in message
news:86DDE0E4-DF1B-423D-93F8-745D0759C620@microsoft.com...
> Platform: Windows Mobile 6
> Application: Pocket Outlook (Messaging)
> Program Description:
> Created an Email Client in my application using Win32 API and MAPI. I'm
> able
> to create and submit my message to Pocket Outlook, but the message resides
> in
> the Outbox until the next synchronization (Send/Receive set @ 5 mins).
> However, I need to send the email as soon as possible, and I've read about
> COM objects such as IMailSyncCallBack, but I can't find any examples of
> how
> to use this interface properly. A lot of the material that's on the
> Internet
> is very limited, and it's hard to decipher. Maybe I'm confused on the
> concept
> of custom transports (and honestly, I don't want to create one if I don't
> have to), but isn't there a way to just use the default transport and
> synchronize, without having to provide the implementation details for the
> abstract class IMailSyncCallBack? Since MSDN states this as a COM
> interface,
> this is what I've been trying to do, however to no avail:
>
> Code:
>
> CLSID clsid;
> LPOLESTR pProgID = L"PocketOutlook.Application"; //Don't think
> this
> is right..
> hr = CLSIDFromProgID(pProgID, &clsid);
>
> IMailSyncCallBack *pMSCB;
>
> CoInitializeEx(NULL, COINIT_MULTITHREADED);
>
> //Following Returns E_NOINTERFACE... Therefore, the CLSID is incorrect.
> hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_HANDLER,
> IID_IMailSyncCallBack, (void**) pMSCB);
> if(SUCCEEDED(hr))
> {
> //pMSCB Methods go here
> pMSCB->Release();
> }
> else
> {
> //Error!
> MessageBox(hWnd, _T("Instance Failed!"), _T("Warning!"), MB_OK);
> CoUninitialize();
> return(-1);
> }
>
> Any help would be greatly appreciated.
> -kvh
> Was this post helpful to you?
>
> Why should I rate a post?
>
>
>
> Expand AllCollapse All