zoukankan      html  css  js  c++  java
  • 二版手机读取SIM通讯录

    TInt GetSimContactCountL()
        {
        TInt SimCntCount = 0;   
        /*this code is just to get the TSY name*/
        CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeUnspecified);     
        CleanupStack::PushL(db);     
        CCommsDbTableView* table = db->OpenTableLC(TPtrC(MODEM));     
        table->GotoFirstRecord();   
        table->ReadTextL(TPtrC(MODEM_TSY_NAME),iTsyName);   
        // Cleanup - CommsDB no longer needed 
        CleanupStack::PopAndDestroy(2); // table,db     
        // Connect to the ETel server 
        RTelServer aTelServer;     
        User::LeaveIfError(aTelServer.Connect());     
        CleanupClosePushL(aTelServer);     
        User::LeaveIfError(aTelServer.LoadPhoneModule(iTsyName));     
        TInt numberOfPhones;     
        User::LeaveIfError(aTelServer.EnumeratePhones(numberOfPhones));     
        SimCntCount = 0;   
        for (TInt i=numberOfPhones; i>0; i--) { 
        // Get the phone name 
        RTelServer::TPhoneInfo phoneInfo; 
        User::LeaveIfError(aTelServer.GetPhoneInfo(i-1,phoneInfo)); 
        // Open the phone by name 
        RBasicGsmPhone phone; 
        User::LeaveIfError(phone.Open(aTelServer,phoneInfo.iName)); 
        TInt phoneBookCount;
        phone.EnumeratePhoneBooks(phoneBookCount);
        RBasicGsmPhone::TPhoneBookInfo aPbInfo;
        for(TInt j=0;j<phoneBookCount;j++){
        phone.GetPhoneBookInfo(j,aPbInfo);
        SimCntCount += aPbInfo.iUsed;
        }
        phone.Close();
        } 
        CleanupStack::PopAndDestroy(1); 
        return SimCntCount;
        }

  • 相关阅读:
    (转)解决AJAX中使用UpdatePanel后再用Response.Write();等无法弹出对话框问题 3法
    ASP.NET AJAX(开发代号Atlas)重要参考资源大收集
    Ajax.NET 和 Atlas 区别
    SqlDataAdapter的几种常用方法
    C# 2.0与泛型
    DataView 使用技巧 [转]
    .net事务
    SQL Server 2005 SQL Server 2000 改进
    Crystal Reports for Visual Studio 2005 学习一(报表绑定方案)
    oracle的substr函数的用法
  • 原文地址:https://www.cnblogs.com/yaoliang11/p/1928915.html
Copyright © 2011-2022 走看看