本文整理汇总了C++中LPMESSAGE::ModifyRecipients方法的典型用法代码示例。如果您正苦于以下问题:C++ LPMESSAGE::ModifyRecipients方法的具体用法?C++ LPMESSAGE::ModifyRecipients怎么用?C++ LPMESSAGE::ModifyRecipients使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPMESSAGE
的用法示例。
在下文中一共展示了LPMESSAGE::ModifyRecipients方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddRecipientW
HRESULT AddRecipientW(LPMESSAGE lpMessage,
ULONG ulRecipientType,
LPWSTR szRecipientName){
HRESULT hRes = S_OK;
LPADRLIST lpAdrList = NULL; // ModifyRecips takes LPADRLIST
LPADRBOOK lpAddrBook = NULL;
hRes = HrAllocAdrList(NUM_RECIP_PROPS, &lpAdrList);
if (SUCCEEDED(hRes) && lpAdrList)
{
// Set up the recipient by indicating how many recipients
// and how many properties will be set on each recipient.
lpAdrList->cEntries = 1; // How many recipients.
lpAdrList->aEntries[0].cValues = NUM_RECIP_PROPS; // How many properties per recipient
lpAdrList->aEntries[0].rgPropVals[p_PR_DISPLAY_NAME_W].ulPropTag = PR_DISPLAY_NAME_W;
lpAdrList->aEntries[0].rgPropVals[p_PR_RECIPIENT_TYPE].ulPropTag = PR_RECIPIENT_TYPE;
lpAdrList->aEntries[0].rgPropVals[p_PR_DISPLAY_NAME_W].Value.lpszW = szRecipientName;
lpAdrList->aEntries[0].rgPropVals[p_PR_RECIPIENT_TYPE].Value.l = ulRecipientType;
// If everything goes right, add the new recipient to the message
// object passed into us.
hRes = lpMessage->ModifyRecipients(MODRECIP_ADD, lpAdrList);
}
if (lpAdrList) FreePadrlist(lpAdrList);
if (lpAddrBook) lpAddrBook->Release();
return hRes;
}
示例2: AddRecipientA
HRESULT AddRecipientA(LPMAPISESSION lpMAPISession,
LPMESSAGE lpMessage,
ULONG ulRecipientType,
LPSTR szRecipientName)
{
HRESULT hRes = S_OK;
LPADRLIST lpAdrList = NULL; // ModifyRecips takes LPADRLIST
LPADRBOOK lpAddrBook = NULL;
if (!lpMessage || !lpMAPISession) return MAPI_E_INVALID_PARAMETER;
hRes = lpMAPISession->OpenAddressBook(
NULL,
NULL,
NULL,
&lpAddrBook);
if (SUCCEEDED(hRes) && lpAddrBook)
{
hRes = HrAllocAdrList(NUM_RECIP_PROPS, &lpAdrList);
if (SUCCEEDED(hRes) && lpAdrList)
{
// Set up the recipient by indicating how many recipients
// and how many properties will be set on each recipient.
lpAdrList->cEntries = 1; // How many recipients.
lpAdrList->aEntries[0].cValues = NUM_RECIP_PROPS; // How many properties per recipient
lpAdrList->aEntries[0].rgPropVals[p_PR_DISPLAY_NAME_W].ulPropTag = PR_DISPLAY_NAME_A;
lpAdrList->aEntries[0].rgPropVals[p_PR_RECIPIENT_TYPE].ulPropTag = PR_RECIPIENT_TYPE;
lpAdrList->aEntries[0].rgPropVals[p_PR_DISPLAY_NAME_W].Value.lpszA = szRecipientName;
lpAdrList->aEntries[0].rgPropVals[p_PR_RECIPIENT_TYPE].Value.l = ulRecipientType;
hRes = lpAddrBook->ResolveName(
0L,
MAPI_UNICODE,
NULL,
lpAdrList);
if (SUCCEEDED(hRes))
{
// If everything goes right, add the new recipient to the message
// object passed into us.
hRes = lpMessage->ModifyRecipients(MODRECIP_ADD, lpAdrList);
}
}
}
if (lpAdrList) FreePadrlist(lpAdrList);
if (lpAddrBook) lpAddrBook->Release();
return hRes;
}