[Cf. Skills] obtain the call number and shield the call in. NET Compact framework.

Source: Internet
Author: User

A person's Valentine's day, his wife is not around, only write code to relieve boredom.
This is an interesting program. Er, that is, automatic phone calls, Valentine's Day dedicated phone calls, dedicated to accompany his wife, huh, huh.
The local method of keybd_event is used to stop the call.

Public static class dropcall
{
Private field # region private field
// Vk key of the end key F4
Private const int vk_f4 = 0x73;
Private constint keyeventf_keyup = 0x0002;
# Endregion

Public fiield # Region Public fiield
// Banned phone number list
Public static list <string> bannedlist = new list <string> ();

/** // <Summary>
/// Simulate a key operation
/// </Summary>
Public static void drop ()
{
Myref. keybd_event (vk_f4, 0, 0, 0 );
Myref. keybd_event (vk_f4, 0, keyeventf_keyup, 0 );
}
# Endregion

The systemstate class and systemproperty class are used to obtain the incoming call number.

Mount event Delegate # region Mount event Delegate
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

We use the cellular simulator to simulate incoming calls.

The program running effect is as follows:

In addition, you can set up a series of phone numbers that you don't want to answer, so that the program will hang them up for you.
For example

Initialize the blocked number list # region initializes the blocked number list
Dropcall. bannedlist. Add ("1 (312) 132-132 ");
# Endregion

When you dial the number 13112132132 in cellular emulator, the simulator will help you stop it.
Click here to download the completed program.

PS: The program is based on. NET cf3.5. If you want to port the program to cf2.0, you may need to make some modifications.
Pss: you may need to refer to the following materials
Use of cellular emulator:
Http://www.cnblogs.com/upto/archive/2007/02/14/cellular-emulater-in-wm6sdk.html
WM common key value (VK) Table: http://www.cnblogs.com/fox23/archive/2008/02/01/keyvalue.html
Lamda expression: http://www.cnblogs.com/fox23/archive/2007/09/26/906581.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.