由于需要催手機里的短消息(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(); 
                                                
                    } 
                    
            } 
        } 
    } 
} 
新聞熱點
疑難解答
圖片精選