由于需要催手机里的短消息(sms)进行操作,现成的api都不能方便的实现,看到最好用的要数inthehand这家第三方控件了,真的很方便,但是这个版本是商业版($49),发布的试用版不支持这个类的,够郁闷的。
其实主要就是利用smsmessagefolder 这个类,哎,有没有什么好办法可以替代它呢?为什么微软不提供操作sms的api呢?也许在下个版本中会提供吧,但愿吧!!
帖段使用smsmessagefolder 类的代码,如下显示就是备份后再删除的功能,真方便!!
ps:inthehand这家网站的路径不小心被我暴出来了:
fatal error: maximum execution time of 30 seconds exceeded in
c:inetpubwwwrootinthehand orumsincludes emplate.php(127) : eval()'d code on line 31
using system;
using system.collections.generic;
using system.text;
using system.io;
using inthehand.windowsmobile.pocketoutlook;
namespace dumpsms
......{
class program
......{
private const string file_name = "sms.txt";
static void main(string[] args)
......{
if (!file.exists(file_name))
......{
outlooksession outsess = new outlooksession();
smsmessagefolder smsflr = outsess.smsaccount.inbox;
if (smsflr.count > 0)
......{
// only save the first sms found
smsmessage smsmsg = smsflr[0];
if (smsmsg.body.length > 0)
......{
streamwriter writestream = file.createtext(file_name);
writestream.writeline(smsmsg.body);
writestream.close();
}
smsmsg.delete();
}
}
}
}
}
新闻热点
疑难解答
图片精选