locked
Windows Mobile handle incoming call RRS feed

  • Question

  •  

    Dear I am developing Windows Mobile Call Block feature as call block as graduation project , previously I posted the follwing thread, that my applicatio environment in visual studio 2008 and windows mobile 6

    http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/b057753f-96c5-4ea2-8947-987aa835b542

    and really thank you I got the most usefull solution over the WWW .But, the professor supervising my graduation project reject the idea to automate the ignore key that exist when an incoming call take place , and emphasize to have a telephony interface .Sure I saw the previous posts that have a very important idea

    Although the codes and solutions not detailed enough for a biggner such like me !!

    for example, the follwing code have a build problems such as telephony interface or namespace can not be found :

     

    If you want there is a way by using a tapi wrapper .
    I explain the idea in my blog: 
    http://programmaremobile.blogspot.com/2009/10/how-to-manage-incoming-call-with.html
    
    I paste a code snippet 
    
    
    public Form1()
            {
                InitializeComponent();
                this.InitializeTelephony();
            }
    
    
            private void InitializeTelephony()
            {
    
    
                m_telephony = new Telephony();
    
    
                //Initialize the telephony class
                m_telephony.Initialize();
    
    
                //Get the cellular line with Monitor and Owner privileges
                m_line = m_telephony.CellularLine(MediaMode.InteractiveVoice, CallPrivilege.Monitor | CallPrivilege.Owner);
    
    
                //Add a new call event
                m_line.NewCall += new Line.NewCallHandler(m_line_NewCall);
            }
    
    
    /// <summary> 
            /// Handles any new calls coming in/out of the phone the  
            /// </summary> 
            /// <param name="call"></param> 
            void m_line_NewCall(Call call) 
            { 
                lineSetCallPrivilege(call.Handle, CallPrivilege.Owner);
                call.HangUp(); 
            }
    
    
         [DllImport("coredll")] 
            extern static public int lineSetCallPrivilege(IntPtr hCall, CallPrivilege dwPrivilege); 
    

    and the follwing code reaaly I did not understand how to make a usefull application using it :

    Code Snippet
            [DllImport("coredll.dll")]
    
            public extern static int FindWindow(string classname, string text);
    
     
    
            [DllImport("coredll.dll")]
    
            public extern static  void ShowWindow(int h, int op);
    
     
    
            private void Form1_Load(object sender, EventArgs e)
    
            {
    
                const string appId = "incomingCallTest";
    
      const string applicationToNotify =    @"\Program Files\PhoneIncomingTest\PhoneIncomingTest.exe";
    
     
    
                SystemState ss = new SystemState(SystemProperty.PhoneIncomingCall,true);
    
                ss.EnableApplicationLauncher(appId, applicationToNotify);
    
                
    
                ss.Changed += new ChangeEventHandler(HandleCall);
    
            }
    
     
    
            public void HandleCall(Object obj, ChangeEventArgs arg)
    
            {
    
                int t = FindWindow("", "Phone - Incoming");
    
                ShowWindow(t, 0);
    
     
    
            }
    
    

     

     

     

     

    Monday, April 5, 2010 6:56 AM

Answers