How to use the. NET Compact framework to implement a simple incoming call firewall?

Source: Internet
Author: User
C # cf.net provides us with a systemstate namespace. We only need to create a State object, and it will be okay to hook up an event. What Ms does on the one hand is commendable!

Microsoft. windowsmobile. Status. systemstate scall = new Microsoft. windowsmobile. Status. systemstate (Microsoft. windowsmobile. Status. systemproperty. phoneincomingcall );

Scall. Changed + = new changeeventhandler (callincoming_changed );

We hung up a change event when calling, and then we can handle it.
One way I can see on the Internet is to use the program to simulate F4 to abort the call in the change event. The Code is as follows:

[Dllimport ("coredll. DLL ")] public static extern void keybd_event (byte bvk, byte bscan, int dwflags, int dwextrainfo); you can use: keybd_event (vk_f4, 0, 0, 0); keybd_event (vk_f4, 0, keyeventf_keyup, 0 );

Note:
The problem with this solution is that the incoming call firewall will not be ideal enough. It will ring before each call, and the function is not completely blocked. Ms users should be able to think of it as well.
But they asked me what to do without doing better. This is what I am wondering about. Maybe he cannot do it at the framework layer.

If you want to do a better job, you should start with the RIL layer to achieve what we need. However, Ms provides too little information about RIL. You can go:
Http://msdn.microsoft.com/en-us/library/aa919462.aspx

I wrote a simple example by myself. After compilation, the size is only 7 kb, which is quite small. Using C # To write MW programs is quite efficient, however, the functionality provided by the Compact framework is far from enough. However, I believe that Ms should soon provide us with a better framework for the impact of the iPhone on the entire functional mobile phone market, I believe Ms has this strength. The IDE provided by MS for our programmers is really incomparable. I personally think it will be useful to you :)!

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.