现在的位置: 首页 > 综合 > 正文

Windows Mobile 获取来电号码和屏蔽来电

2013年06月11日 ⁄ 综合 ⁄ 共 1519字 ⁄ 字号 评论关闭

今天接到一个特殊任务...在 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, 
000);
         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

抱歉!评论已关闭.