C#代码

        [DllImport("coredll.dll")]
        public static extern bool PostMessage(IntPtr hWnd, uint Msg, int wParam, IntPtr lParam);

        const uint HWND_BROADCAST = 0xffff;
        const uint WM_APP = 0x8000;
        const uint WM_WZCSYSTRAYICON = WM_APP + 100;
        const uint WM_LBUTTONDBLCLK = 0x0203;

        public Form1()
        {
            InitializeComponent();
        }
        //弹出wince自带的wifi配置窗口
        private void button1_Click(object sender, EventArgs e)
        {
            PostMessage((IntPtr)HWND_BROADCAST, WM_WZCSYSTRAYICON, 1, (IntPtr)WM_LBUTTONDBLCLK);
        }

 

用C++更省事

#define WM_WZCSYSTRAYICON (WM_APP+100)
void CWifiPopDlg::OnBnClickedButton1()
{
    ::PostMessage(HWND_BROADCAST, WM_WZCSYSTRAYICON, 1, WM_LBUTTONDBLCLK);
}

 

posted on 2012-02-14 11:53  凌风的博客  阅读(1029)  评论(0编辑  收藏  举报