[CF.Skills]Windows Mobile如何編程實現免提功能

來源:互聯網
上載者:User
摘要:本文闡述了如何在Windows mobile的裝置上使用Managed 程式碼在來電時觸發擴音器,間接實現免提的功能
Keywords
Windows Mobile,.NET CompactFramework,Speaker,keybd_event,C#

相關文章
http://www.cnblogs.com/fox23/archive/2008/02/15/phoneincoming.html
http://www.cnblogs.com/fox23/archive/2008/03/12/phonestate1.html

前提
你的WM裝置必須支援擴音器,模擬器自然不行

首先,需要匯入用於發送按鍵訊息的本地函數    class NativeHelper
    {
        private const int KEYEVENTF_KEYUP = 0x0002;
        [DllImport("coredll.dll")]
        private static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
        /**//// <summary>
        /// 類比按鍵觸發擴音器
        /// </summary>
        public static void TriggleSpeaker()
        {
            keybd_event((byte)Keys.F16, 0, 0, 0);
            Thread.Sleep(500);
            keybd_event((byte)Keys.F16, 0, KEYEVENTF_KEYUP, 0);
        }
        /**//// <summary>
        /// 類比按鍵接電話
        /// </summary>
        public static void AcceptCall()
        {
            keybd_event((byte)Keys.F3, 0, 0, 0);
            Thread.Sleep(500);
            keybd_event((byte)Keys.F3, 0, KEYEVENTF_KEYUP, 0);
        }
    }

調用的時候:            SystemState phonestate = new SystemState(SystemProperty.PhoneIncomingCall);
            phonestate.Changed += new ChangeEventHandler(phonestate_Changed);


        void phonestate_Changed(object sender, ChangeEventArgs args)
        {
            NativeHelper.AcceptCall();
            NativeHelper.TriggleSpeaker();
        }

論壇上也有相關問題,歡迎來做進一步的討論:
http://forums.microsoft.com/china/ShowPost.aspx?PostID=3210021&SiteID=15
http://www.winbile.net/bbs/forums/threads/1036681.aspx

Enjoy it!


Freesc Huang
  黃季冬<fox23>@HUST
  2008.04.27

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.