亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? smshelper.cpp

?? 使用CEAPI 開發(fā)的 sms 應用程序.對Windows CE 平臺下的sms 開發(fā)很有幫助.
?? CPP
字號:
#include "stdafx.h"
#include <atlbase.h>
#include <cemapi.h>
#include <mapiutil.h>
#include "resource.h"

/////////////////////////////////////////////////////////////////////////////////////////////
// This function is used to get the msgstore named SMS from msgstores on the
// device.
// I could have used just raw pointers but it is much easier and safer to just 
// use smart pointers.
HRESULT GetSMSMsgStore(const CComPtr<IMAPISession>& spSession, CComPtr<IMsgStore>& spMsgStore)
{
	// first we get the msgstores table from the session
	CComPtr<IMAPITable> spTable;
	HRESULT hr = spSession->GetMsgStoresTable(MAPI_UNICODE, &spTable);
	if (FAILED(hr))
	{
		AfxMessageBox(IDS_SMS_FAIL_MSGSTORE_TABLES);
		return FALSE;
	}

	// next we loop over the message stores opening each msgstore and
	// getting its name to see if the name matches SMS.
	// If it does then we break out of the loop
	while (TRUE)
	{
		SRowSet* pRowSet = NULL;
		hr = spTable->QueryRows(1, 0, &pRowSet);

		// If we failed to query the
		// rows then we need to break
		if (FAILED(hr))
		{
			AfxMessageBox(IDS_SMS_FAILEDTABLE);
			break;
		}

		// if we got no rows back then just exit the loop
		//remembering to set an error
		if (pRowSet->cRows == 1)
		{
			ASSERT(pRowSet->aRow[0].lpProps->ulPropTag == PR_ENTRYID);
			SBinary& blob = pRowSet->aRow[0].lpProps->Value.bin;
			hr = spSession->OpenMsgStore(NULL, blob.cb, (LPENTRYID)blob.lpb, NULL, 0, &spMsgStore);
			if (FAILED(hr))
				AfxMessageBox(IDS_SMS_FAILED_OPENMSGSTORE);

		}
		else
		{
			AfxMessageBox(IDS_SMS_MSGSTORENOTFOUND);
			hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
		}

		// now remember to free the row set
		FreeProws(pRowSet);
		if (FAILED(hr))
		{
			break;
		}

		// now get the display name property from the
		// message store to compare it against the name
		// 'SMS'
		SPropTagArray props;
		props.cValues = 1;
		props.aulPropTag[0] = PR_DISPLAY_NAME;

		ULONG cValues;
		SPropValue* pProps = NULL;
		hr = spMsgStore->GetProps(&props, MAPI_UNICODE, &cValues, &pProps);
		if (FAILED(hr) || cValues != 1)
		{
			AfxMessageBox(IDS_SMS_FAILED_GETNAME);
			break;
		}

		// if the name matches SMS then break and as
		// hr == S_OK the current MsgStore smart pointer
		// will correctly be set.
		if (_tcsicmp(pProps[0].Value.lpszW, _T("SMS")) == 0)
		{
			break;
		}
	}

	// if we failed for some reason then we clear out
	// the msgstore smartpointer and return the error.
	if (FAILED(hr))
	{
		spMsgStore.Release();
	}

	return hr;
}


/////////////////////////////////////////////////////////////////////////////////////////////
// This function is used to get the folder named drafts from the msgstore on the
// device.
// I could have used just raw pointers but it is much easier and safer to just 
// use smart pointers.
HRESULT GetSMSFolder(const CComPtr<IMsgStore>& spMsgStore, CComPtr<IMAPIFolder>& spFolder)
{
        // Now get the Drafts folder.
		SPropTagArray propDefaultFolder;
		propDefaultFolder.cValues = 1;
		propDefaultFolder.aulPropTag[0] = PR_CE_IPM_DRAFTS_ENTRYID;
		
		ULONG			cValues;
		LPSPropValue	pPropVals;
        HRESULT hr = spMsgStore->GetProps (&propDefaultFolder, MAPI_UNICODE, &cValues, &pPropVals);
        if (FAILED(hr))
		{
			AfxMessageBox(IDS_SMS_FOLDERNOTFOUND);
			return hr;
		}
    
		SBinary& eidDrafts = pPropVals->Value.bin;

        hr = spMsgStore->OpenEntry(eidDrafts.cb, (LPENTRYID)eidDrafts.lpb, NULL, MAPI_MODIFY, NULL, (LPUNKNOWN*)&spFolder);
		if (FAILED(hr))
		{
			AfxMessageBox(IDS_SMS_FOLDERNOTOPENED);
		}

		return hr;
}

/////////////////////////////////////////////////////////////////////////////////////////////
// This function is used to get the send the message.
// This uses an opened MAPI session
HRESULT SendSMSMessage(const CComPtr<IMAPISession>& spSession, LPCTSTR lpszFrom, LPCTSTR lpszTo, LPCTSTR lpszMessage)
{

	// now get the SMS message store
	CComPtr<IMsgStore> spMsgStore;
	HRESULT hr = GetSMSMsgStore(spSession, spMsgStore);
	if (FAILED(hr))
	{
		return hr;
	}

	CComPtr<IMAPIFolder> spFolder;

	hr = GetSMSFolder(spMsgStore, spFolder);
	if (FAILED(hr))
	{
		return hr;
	}

	CComPtr<IMessage> spMessage;
	hr = spFolder->CreateMessage(NULL, 0 ,&spMessage);
	if (FAILED(hr))
	{
		AfxMessageBox(IDS_SMS_FAIL_CREATEMESSAGE);
		return hr;
	}

	// set the recipients
	// set up the required fields for a recipient
	SPropValue propRecipient[3];
	// it is vital we clear the property structure
	// as there are fields we do not use but MAPI seems
	// to be sentative to them.
	ZeroMemory(&propRecipient, sizeof(propRecipient));
	// set the recipient type which coul be to, cc, bcc
	// but ehre must at least be a to field
	propRecipient[0].ulPropTag = PR_RECIPIENT_TYPE;
	propRecipient[0].Value.l = MAPI_TO;

	// we set the type of address to sms instead of
	// smtp
	propRecipient[1].ulPropTag = PR_ADDRTYPE;
	propRecipient[1].Value.lpszW = _T("SMS");
	// we finally set the email address to the
	// phone number of the person we are sending the message
	// to
	propRecipient[2].ulPropTag = PR_EMAIL_ADDRESS;
	propRecipient[2].Value.lpszW = (LPWSTR)lpszTo;

	// set the addrlist to point to the properties
	ADRLIST adrlist;
	adrlist.cEntries = 1;
	adrlist.aEntries[0].cValues = 3;
	adrlist.aEntries[0].rgPropVals = (LPSPropValue)(&propRecipient);

	// finally modify the recipients of the message
	hr = spMessage->ModifyRecipients(MODRECIP_ADD, &adrlist); 

	if (FAILED(hr))
	{
		AfxMessageBox(IDS_SMS_FAILED_ADDRECIPIENTS);
		return hr;
	}
	else
		; // added the recipient to the message

	// now we set the additional properties for the 
	// message
	SPropValue props[4];

	//note how we zero out the contents of the
	// structure as MAPI is sensative to the
	// contents of other fields we do not use.
	ZeroMemory(&props, sizeof(props));

	// first set the subject of the message
	// as the sms we are going to send
	props[0].ulPropTag = PR_SUBJECT;
	props[0].Value.lpszW = (LPWSTR)lpszMessage;

	// next set the senders email address to
	// the phone number of the person we are
	// sending the message to
	props[1].ulPropTag = PR_SENDER_EMAIL_ADDRESS;
	props[1].Value.lpszW = (LPWSTR)lpszFrom;

	// finally and most importantly tell mapi
	// this is a sms message in need of delivery
	props[2].ulPropTag = PR_MSG_STATUS;
	props[2].Value.ul = MSGSTATUS_RECTYPE_SMS;

    props[3].ulPropTag = PR_MESSAGE_FLAGS;
    props[3].Value.ul = MSGFLAG_FROMME | MSGFLAG_UNSENT;

	hr = spMessage->SetProps(sizeof(props) / sizeof(props[0]), (LPSPropValue)&props, NULL);
	if (FAILED(hr))
	{
		AfxMessageBox(IDS_SMS_FAIL_SETPROPS);
		return hr;
	}

	// having set all the required fields we can now
	// pass the message over to the msgstore transport
	// to be delivered.
	hr = spMessage->SubmitMessage(0);
	if (FAILED(hr))
	{
		AfxMessageBox(IDS_SMS_FAIL_SUBMITMSG);
		return hr;
	}

	return FALSE;
}

/////////////////////////////////////////////////////////////////////////
// This is the function that creates the session, using the
// from, the recipient and the message.
// This opens the session, opens the sms message store and opens
// the drafts folder then create a new message and sets the sender,
// recipient and messag, then finally sends the message.
BOOL DoSendMessage(LPCTSTR lpszFrom, LPCTSTR lpszTo, LPCTSTR lpszMessage)
{

	HRESULT hr = MAPIInitialize(NULL);
	if (FAILED(hr))
	{
		AfxMessageBox(IDS_SMS_FAIL_MAPIINIT);
		return hr;
	}
	else
	; // initialized the MAPI subsystem

	CComPtr<IMAPISession> spSession;

	BOOL bRet = FALSE;

	hr = MAPILogonEx(0 ,NULL, NULL, 0, &spSession);
	if (FAILED(hr))
	{
		AfxMessageBox(IDS_SMS_FAIL_MAPILOGON);
	}
	else
	{
		bRet = SUCCEEDED(SendSMSMessage(spSession, lpszFrom, lpszTo, lpszMessage));

		spSession->Logoff(0, 0, 0);

		spSession.Release();
	}

	MAPIUninitialize();

	return bRet;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产aⅴ天堂久久| 国产精品人妖ts系列视频| 成人av小说网| 国产精品综合一区二区| 精品一区二区三区免费播放 | 欧美精品黑人性xxxx| 在线免费亚洲电影| 欧美性高清videossexo| 在线观看区一区二| 欧美日韩国产综合视频在线观看 | 国产一区二区三区免费播放| 麻豆免费精品视频| 韩国一区二区在线观看| 国内一区二区在线| 国产91对白在线观看九色| 成人av在线影院| 91麻豆免费在线观看| 91国产免费观看| 欧美二区三区的天堂| 欧美大片日本大片免费观看| 久久综合色之久久综合| 亚洲国产高清在线观看视频| 亚洲免费在线电影| 日韩成人av影视| 国产精品一区一区| 色婷婷综合五月| 制服视频三区第一页精品| 亚洲精品一区二区三区香蕉| 中文字幕亚洲成人| 日韩国产一二三区| 国产成人自拍在线| 欧美色涩在线第一页| 精品国产乱码久久久久久牛牛| 国产无一区二区| 一区二区成人在线视频 | 国产日韩欧美精品在线| 亚洲人成影院在线观看| 男人操女人的视频在线观看欧美| 国产精品综合二区| 欧美乱熟臀69xxxxxx| 欧美国产成人在线| 视频一区国产视频| hitomi一区二区三区精品| 欧美电影在线免费观看| 国产精品热久久久久夜色精品三区| 午夜久久久久久| 成人h动漫精品| 日韩欧美一区二区视频| 亚洲人成网站在线| 国产一二三精品| 欧美精品aⅴ在线视频| 专区另类欧美日韩| 国产一区二区免费在线| 91精品国产黑色紧身裤美女| 国产精品久久久久毛片软件| 老司机精品视频导航| 91久久精品日日躁夜夜躁欧美| 久久综合国产精品| 毛片av中文字幕一区二区| 欧美影视一区在线| 亚洲欧洲成人自拍| 国产成人av一区二区三区在线观看| 欧美精品丝袜久久久中文字幕| 自拍偷拍亚洲综合| 国产成人av网站| 日韩美女天天操| 蜜臀av性久久久久蜜臀aⅴ流畅| 一本久久a久久免费精品不卡| 国产婷婷色一区二区三区四区| 久久91精品国产91久久小草| 欧美综合欧美视频| 中国色在线观看另类| 国产成人在线视频网站| 久久综合色一综合色88| 国产在线精品一区二区三区不卡| 欧美一级高清片| 琪琪久久久久日韩精品| 欧美猛男超大videosgay| 亚洲一区二区黄色| 欧美手机在线视频| 天天色天天操综合| 在线电影院国产精品| 日韩电影在线一区二区三区| 7777精品伊人久久久大香线蕉完整版| 亚洲成va人在线观看| 欧美日韩高清一区| 久久精品国产精品亚洲红杏| 精品三级在线看| 国产精品1区2区| 国产精品视频一二| 99国产精品99久久久久久| 亚洲精品视频免费观看| 欧洲一区二区av| 日韩经典一区二区| 久久亚洲捆绑美女| 成人av在线看| 亚洲一区二区在线观看视频| 欧美一区二区三区四区视频| 精品一区二区三区不卡| 国产精品青草久久| 欧美亚洲自拍偷拍| 麻豆freexxxx性91精品| 国产三级三级三级精品8ⅰ区| caoporn国产一区二区| 污片在线观看一区二区| 亚洲精品一区二区精华| 99综合电影在线视频| 肉丝袜脚交视频一区二区| 2024国产精品| 色菇凉天天综合网| 久久综合综合久久综合| 国产精品福利一区| 91精品国产欧美一区二区成人 | 中文字幕一区二区不卡| 欧美裸体bbwbbwbbw| 懂色av一区二区三区免费观看 | 日本少妇一区二区| 国产精品免费网站在线观看| eeuss鲁片一区二区三区在线看| 午夜私人影院久久久久| 久久久精品2019中文字幕之3| 色综合久久88色综合天天| 久久99深爱久久99精品| 亚洲欧美韩国综合色| 26uuu精品一区二区三区四区在线| av动漫一区二区| 久久国产精品99久久久久久老狼| 亚洲天天做日日做天天谢日日欢| 精品免费视频.| 欧美日韩一区在线观看| 成人性视频免费网站| 日本aⅴ免费视频一区二区三区| 综合av第一页| 国产免费成人在线视频| 亚洲精品在线网站| 日韩一区二区在线免费观看| 色播五月激情综合网| 国产成人精品免费一区二区| 日本aⅴ亚洲精品中文乱码| 亚洲一级在线观看| 中文字幕视频一区| 国产精品第四页| 国产精品家庭影院| 中文一区二区在线观看| 久久综合九色综合97婷婷| 日韩一区二区在线免费观看| 欧美久久久久久久久久| 精品视频999| 欧美高清一级片在线| 欧美亚洲高清一区二区三区不卡| 91在线高清观看| 99riav久久精品riav| 99久久99久久精品免费观看| 不卡的av电影| 成人免费观看视频| 成人国产精品免费| 91偷拍与自偷拍精品| 91免费在线播放| 色综合中文综合网| 天堂av在线一区| 五月婷婷激情综合网| 亚洲国产欧美在线人成| 亚洲一区二区黄色| 午夜精品久久久久久久99水蜜桃| 一区二区三区美女视频| 亚洲欧洲日韩av| 亚洲欧美激情一区二区| 亚洲一区在线视频观看| 午夜久久久久久电影| 麻豆精品一区二区综合av| 蜜臀av亚洲一区中文字幕| 激情综合网天天干| 粉嫩aⅴ一区二区三区四区 | 欧美无乱码久久久免费午夜一区| 欧美日韩亚洲综合一区 | 久久精品国产澳门| 夫妻av一区二区| 在线免费观看日本欧美| 3d动漫精品啪啪| 国产日韩欧美麻豆| 亚洲一区二区三区四区在线 | 岛国精品一区二区| 色香蕉久久蜜桃| 欧美视频一区在线| 日韩一级在线观看| 中文字幕一区在线| 日韩电影在线一区二区三区| 国产99久久精品| 欧美三级中文字幕在线观看| 精品三级av在线| 成人欧美一区二区三区黑人麻豆| 午夜精品一区在线观看| 国产精品一区二区三区网站| 色婷婷久久综合| 久久美女艺术照精彩视频福利播放| 亚洲欧洲一区二区在线播放| 日韩高清一区二区| 不卡的电影网站| 精品乱人伦一区二区三区| 亚洲综合色噜噜狠狠|