解决方案 »

  1.   

            [System.Runtime.InteropServices.DllImport("user32.dll")]
            private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
            const int MOUSEEVENTF_MOVE = 0x0001;
            const int MOUSEEVENTF_LEFTDOWN = 0x0002;
            const int MOUSEEVENTF_LEFTUP = 0x0004;
            const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
            const int MOUSEEVENTF_RIGHTUP = 0x0010;
            const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
            const int MOUSEEVENTF_MIDDLEUP = 0x0040;
            const int MOUSEEVENTF_ABSOLUTE = 0x8000;            mouse_event(MOUSEEVENTF_MOVE, 200, 0, 0, 0);            mouse_event(MOUSEEVENTF_LEFTDOWN, 1, 0, 0, 0);
                mouse_event(MOUSEEVENTF_LEFTUP, 1, 0, 0, 0);
      

  2.   

    如何调用windows的API ?请说详细点
      

  3.   

    贴出你的代码,我看你怎么用的.
    鼠标点击是要按下再放开的,
    mouse_event(MOUSEEVENTF_LEFTDOWN, 1, 0, 0, 0);
                mouse_event(MOUSEEVENTF_LEFTUP, 1, 0, 0, 0);
    这2个方法你都得执行.不能按下就不管了.
      

  4.   

            //开始录像
            private void btn_startrecord_Click(object sender, EventArgs e)
            {
                if (btn_play.Text == "播 放")
                {
                    MessageBox.Show("请先播放", "温馨提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                btn_stoprecord.Enabled = true;
                btn_startrecord.Enabled = false;            //得到路径
                string myPath = string.Format("{0}\\{1}.avi", Application.StartupPath, DateTime.Now.ToString(@"yyyy_MM_dd HHmmss"));
                wcam.kinescopePath = myPath;
                //======================================================
                delegateKinescope myK = new delegateKinescope(wcam.Kinescope);//委托
                Thread threadKinescope = new Thread(new ThreadStart(myK));//线程
                //threadKinescope.IsBackground = true;//后台运行
                //threadKinescope.SetApartmentState(ApartmentState.STA);//单线程
                //threadKinescope.SetApartmentState(ApartmentState.MTA);//多线程
                threadKinescope.Start();//开始运行            //======================================================
                //Application.DoEvents();            //======================================================
                mouse_event(MOUSEEVENTF_RIGHTDOWN, 1, 0, 0, 0);
                mouse_event(MOUSEEVENTF_RIGHTUP, 1, 0, 0, 0);
                Thread.Sleep(200);            //======================================================
                //this.Cursor = Cursors.Default;
                //Thread.Sleep(200);
                //用Keys.SendWait方法即可实现单击鼠标左键
                //System.Windows.Forms.SendKeys.SendWait("{ESC}");
                //System.Windows.Forms.SendKeys.Send("{ESC}");            //System.Windows.Forms.SendKeys.Send("{Right}");
                //System.Windows.Forms.SendKeys.Flush();
                //======================================================
            }
      

  5.   

    刚刚我又测试了一下,点击按钮,然后将鼠标移出窗口,右键
    可以在我的桌面上弹出右键菜单
    代码没有问题
    你在btn_startrecord_Click事件里执行右键单击,你按钮上有右键事件么,如果没有,单击右键当然是没反应.
      

  6.   

    你想在什么地方执行鼠标右键单击,你得先执行move方法,将鼠标移过去啊