Windows Mobile 擷取來電號碼和屏蔽來電

來源:互聯網
上載者:User

今天接到一個特殊任務...在 Windows Mobile 中獲得來電號碼,其實它本身就有個來電顯示,可現在要求就是要自己寫程式來完成這個來電顯示...

沒辦法...雖然沒搞過...但是這個東東好像比較重要哦...所以還是蒙頭搞咯..上網找資料...耶耶!~~~

 

方法如下:

自動掛來電
其中掛斷電話主要用到了keybd_event這個本地方法

public static class DropCall
{
    #region 私人欄位
    //End鍵的VK索引值 F4
    private const int VK_F4 = 0x73;
    private const int KEYEVENTF_KEYUP = 0x0002;
    #endregion

    #region 公有欄位
    //封鎖的電話號碼單
    public static List<String> BannedList = new List<String>();

    /**//// <summary>
    /// 類比一次按鍵動作
    /// </summary>
    public static void Drop()
    {
         MyRef.keybd_event(VK_F4, 0, 0, 0);
         MyRef.keybd_event(VK_F4, 0, KEYEVENTF_KEYUP, 0);
    }
    #endregion
}

獲得來電號碼用到了SystemState類和SystemProperty類

#region 掛載事件委託
SystemState state = new SystemState(SystemProperty.PhoneIncomingCallerNumber);
SystemState SS = new SystemState(SystemProperty.PhoneIncomingCall);
SS.Changed += new ChangeEventHandler(SS_Changed);
state.Changed += new ChangeEventHandler(state_Changed);
#endregion

我們利用蜂窩模擬器類比來電

  

程式運行效果如下:

 

另外你可以設定一系列的不想接的電話,讓程式替你掛斷它們
比如:

#region 初始化屏蔽號碼名單
DropCall.BannedList.Add("1 (312) 132-132");
#endregion

那麼當你在Cellular Emulator中撥出號碼13112132132後,模擬器會幫你掛斷它

完整程式下載: dropcallDemo.rar

要求環境: Windows Mobile 6 Professional SDK   .Net Compact Framework 3.5

Windows Mobile 6 Professional SDK :

http://www.microsoft.com/downloads/details.aspx?familyid=06111A3A-A651-4745-88EF-3D48091A390B&displaylang=en 

 

您可能需要參考下列資料: 

Cellular Emulator的使用: http://www.cnblogs.com/sukiwqy/archive/2009/12/06/1618192.html

Windows Mobile 常用索引值(VK)對應表: http://www.cnblogs.com/sukiwqy/archive/2009/12/06/1618204.html

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.