Reference:
http://www.cnblogs.com/allenlooplee/archive/2009/01/14/1375941.html
添加引用:
using Microsoft.WindowsMobile;
using Microsoft.WindowsMobile.PocketOutlook;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;
发短信:
SmsMessage msg = new SmsMessage(phoneNumber, message);
msg.Send();
接收短信过滤功能:
(接收到包含"What're you doning"的短信后自动发送预先设置好的状态信息)
private MessageInterceptor m_MsgInterceptor = new MessageInterceptor(InterceptionAction.Notify);
m_MsgInterceptor.MessageCondition = new MessageCondition(
MessageProperty.Body,
MessagePropertyComparisonType.Contains,
"What're you doing",
false);
m_MsgInterceptor.MessageReceived += new MessageInterceptorEventHandler(m_MsgInterceptor_MessageReceived);
private void m_MsgInterceptor_MessageReceived(object sender, MessageInterceptorEventArgs e)
{
SendSms(e.Message.From.Address, statusCombox.Text);
}
m_MsgInterceptor.MessageCondition = new MessageCondition(
MessageProperty.Body,
MessagePropertyComparisonType.Contains,
"What're you doing",
false);
m_MsgInterceptor.MessageReceived += new MessageInterceptorEventHandler(m_MsgInterceptor_MessageReceived);
private void m_MsgInterceptor_MessageReceived(object sender, MessageInterceptorEventArgs e)
{
SendSms(e.Message.From.Address, statusCombox.Text);
}