|
|
|
date: Thu, 26 Jun 2008 08:12:05 +0200,
group: microsoft.public.platformsdk.mapi
back
How to use MapiSendMail with MAPI_UNICODE?
I was asked by a collegue to post the following question:
------------------------------------
Referring to <http://support.microsoft.com/?scid=kb;en-us;252627> I
tried the code quoted below with Outlook 2003 (I expected Outlook 2003
to support MAPI_UNICODE referring to
<http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.messaging/2004-10/0401.html>).
The Outlook mail editor pops up but unfortunately just displays a "t"
(instead of "test ...") in the subject and the body edit control. It
seems as if Outlook doesn't get that I am providing Unicode contents
and stops at the first 0x00 ANSI character (being the lowbyte of the
first Unicode character), despite of using the MAPI_UNICODE flag.
What am I doing wrong?
ULONG hParent = (ULONG)AfxGetMainWnd()->GetSafeHwnd();
LHANDLE hSession = NULL;
//ATTENTION: MAPI interface decl in <MAPI.H> always expects LPSTR
types (even if content is UNICODE)
if (MapiLogon(hParent, (LPSTR) L"", (LPSTR) L"",
MAPI_LOGON_UI|MAPI_UNICODE, 0, &hSession) == SUCCESS_SUCCESS)
{
MapiMessage Msg = {0};
Msg.lpszSubject = (LPSTR) L"test subject";
Msg.lpszNoteText = (LPSTR) L"test mail body";
Msg.flFlags = MAPI_UNICODE;
UINT32 nMAPIRet = MapiSendMail(hSession, hParent, &Msg,
MAPI_DIALOG|MAPI_UNICODE, 0);
TRACE(_T("MAPISendMail returned %ld"), nMAPIRet);
MapiLogoff(hSession, hParent, 0, 0);
}
date: Thu, 26 Jun 2008 08:12:05 +0200
author: Christian Kaiser
Re: How to use MapiSendMail with MAPI_UNICODE?
Simple MPAI does not support Unicode.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Christian Kaiser" wrote in message
news:u17fQO11IHA.6112@TK2MSFTNGP02.phx.gbl...
>I was asked by a collegue to post the following question:
>
> ------------------------------------
>
> Referring to <http://support.microsoft.com/?scid=kb;en-us;252627> I
> tried the code quoted below with Outlook 2003 (I expected Outlook 2003
> to support MAPI_UNICODE referring to
> <http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.messaging/2004-10/0401.html>).
>
> The Outlook mail editor pops up but unfortunately just displays a "t"
> (instead of "test ...") in the subject and the body edit control. It
> seems as if Outlook doesn't get that I am providing Unicode contents
> and stops at the first 0x00 ANSI character (being the lowbyte of the
> first Unicode character), despite of using the MAPI_UNICODE flag.
>
> What am I doing wrong?
>
>
>
> ULONG hParent = (ULONG)AfxGetMainWnd()->GetSafeHwnd();
>
> LHANDLE hSession = NULL;
>
> //ATTENTION: MAPI interface decl in <MAPI.H> always expects LPSTR
> types (even if content is UNICODE)
>
> if (MapiLogon(hParent, (LPSTR) L"", (LPSTR) L"",
> MAPI_LOGON_UI|MAPI_UNICODE, 0, &hSession) == SUCCESS_SUCCESS)
>
> {
>
> MapiMessage Msg = {0};
>
> Msg.lpszSubject = (LPSTR) L"test subject";
>
> Msg.lpszNoteText = (LPSTR) L"test mail body";
>
> Msg.flFlags = MAPI_UNICODE;
>
> UINT32 nMAPIRet = MapiSendMail(hSession, hParent, &Msg,
> MAPI_DIALOG|MAPI_UNICODE, 0);
>
> TRACE(_T("MAPISendMail returned %ld"), nMAPIRet);
>
> MapiLogoff(hSession, hParent, 0, 0);
>
> }
>
>
date: Fri, 27 Jun 2008 11:20:48 -0700
author: Dmitry Streblechenko
|
|