InTheHand提供的类操作SMS。。

由于需要催手机里的短消息(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(); 
                                                
                    }
 
                    
            }
 

        }
 
    }
 
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值