一个人的情人节,老婆不在身边,只有写写代码解解闷了。
这是一个有趣的程序,厄,就是自动挂电话,情人节专门挂情人的电话,专心陪老婆,呵呵。
其中挂断电话主要用到了keybd_event这个本地方法
![](Images/OutliningIndicators/None.gif)
![](Images/OutliningIndicators/ExpandedBlockStart.gif)
![](Images/OutliningIndicators/ContractedBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/b854634c0904529d4018c4c3336be836.gif)
![](Images/OutliningIndicators/ContractedSubBlock.gif)
![](Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/ContractedSubBlock.gif)
![](Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](Images/OutliningIndicators/ContractedSubBlock.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/b854634c0904529d4018c4c3336be836.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](Images/OutliningIndicators/ExpandedBlockEnd.gif)
获得来电号码用到了SystemState类和SystemProperty类
![](Images/OutliningIndicators/ContractedBlock.gif)
![](Images/OutliningIndicators/ExpandedBlockStart.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/ExpandedBlockEnd.gif)
我们利用蜂窝模拟器模拟来电
程序运行效果如下:
另外你可以设置一系列的不想接的电话,让程序替你挂断它们
比如
![](Images/OutliningIndicators/ContractedBlock.gif)
![](Images/OutliningIndicators/ExpandedBlockStart.gif)
![](Images/OutliningIndicators/InBlock.gif)
![](Images/OutliningIndicators/ExpandedBlockEnd.gif)
那么当你在Cellular Emulator中拨出号码13112132132后,模拟器会帮你挂断它
完成的程序点此处下载
PS:程序是基于.NET CF3.5的,如果要移植到CF2.0上可能还要稍做修改
PSS:您可能需要参考下列资料
Cellular Emulator的使用:
http://www.cnblogs.com/upto/archive/2007/02/14/cellular-emulater-in-wm6sdk.html
WM常用键值(VK)对应表:http://www.cnblogs.com/fox23/archive/2008/02/01/keyvalue.html
Lamda表达式:http://www.cnblogs.com/fox23/archive/2007/09/26/906581.html