问题的根本在于 保存时sms的内容没有按照unicode类型保存。设置成unicode的类型就搞定了。
代码如下:
IMAPIFolder* pCurFolder = GetMsgFolder(ID_DRAFTS);
SPropValue Data[3];
SPropValue propVals[1];
MAPINAMEID mapiNameId;
ZeroMemory(&mapiNameId, sizeof(mapiNameId));
GUID PS_MAPI = {0x00020328, 0, 0, 0xC0,0,0,0,0,0,0,0x46};
mapiNameId.lpguid = (LPGUID)&PS_MAPI;
mapiNameId.ulKind = MNID_STRING;
mapiNameId.Kind.lpwstrName = L "SMS:Unicode ";
LPMAPINAMEID pmapiNameId = &mapiNameId;
LPSPropTagArray psPropArr = NULL;
hr=pCurFolder-> CreateMessage(NULL,0,&pMessage);
if(FAILED(hr))
goto Exit;
hr = pMessage-> GetIDsFromNames(1, &pmapiNameId, MAPI_CREATE, &psPropArr);
if (FAILED(hr))
{
if (NULL != psPropArr)
{
MAPIFreeBuffer(psPropArr);
psPropArr = NULL;
}
pMessage-> Release();
pCurFolder-> Release();
return hr;
}
if (NULL != psPropArr)
{
propVals[0].ulPropTag = CHANGE_PROP_TYPE(psPropArr[0].aulPropTag[0], PT_BOOLEAN);
propVals[0].Value.b = TRUE;
hr = pMessage-> SetProps(1, propVals, NULL);
ASSERT(SUCCEEDED(hr));
if (FAILED(hr))
{
MAPIFreeBuffer(psPropArr);
psPropArr = NULL;
pMessage-> Release();
pCurFolder-> Release();
return hr;
}
MAPIFreeBuffer(psPropArr);
}
Data[0].ulPropTag = PR_SUBJECT;
Data[0].Value.lpszW =pSms-> szSubject;
Data[1].ulPropTag = PR_MSG_STATUS;
Data[1].Value.ul = MSGSTATUS_RECTYPE_SMS;
Data[2].ulPropTag = PR_MESSAGE_FLAGS;
Data[2].Value.ul = MSGFLAG_UNSENT|MSGFLAG_FROMME;
pMessage-> SetProps(sizeof(Data)/sizeof(Data[0]),(LPSPropValue)Data,NULL);
SetMsgRecipient(pMessage, pSms);
hr = pMessage-> SubmitMessage(0);