//开始录像
SendMessage(hwndc, WM_CAP_FILE_SET_CAPTURE_FILEA, 0, SaveVideoFileDialog.FileName);
SendMessage(hwndc, WM_CAP_SEQUENCE, 0, 0);
//停止录像
SendMessage(hwndc, WM_CAP_STOP, 0, 0);
异步委托如何实现?
谢谢。

解决方案 »

  1.   


          AsyncOperation asyncOperation;
          asyncOperation = AsyncOperationManager.CreateOperation(null);
          asyncOperation.Post(
              delegate
              {
                  SendMessage(hwndc, WM_CAP_FILE_SET_CAPTURE_FILEA, 0, SaveVideoFileDialog.FileName); 
                  SendMessage(hwndc, WM_CAP_SEQUENCE, 0, 0); 
              }, null
              );      asyncOperation.Post(
              delegate
              {
                  SendMessage(hwndc, WM_CAP_STOP, 0, 0); 
              }, null
              );
      

  2.   

            /// <summary>
            /// 开始录像
             /// </summary>
            /// <param name="path">保存路径</param>
            private void VideoBegin(string path)
            {
                SaveVideoFileDialog = new SaveFileDialog();
                SaveVideoFileDialog.FileName = DateTime.Now.ToString("yyyyMMddhhmmss");
                SaveVideoFileDialog.Filter = "*.avi|*.avi";
                if (SaveVideoFileDialog.ShowDialog() == DialogResult.OK)
                {
                    asyncOperation = AsyncOperationManager.CreateOperation(null);
                    asyncOperation.Post(
                    delegate
                    {
                        SendMessage(hwndc, WM_CAP_FILE_SET_CAPTURE_FILEA, 0, SaveVideoFileDialog.FileName);
                        SendMessage(hwndc, WM_CAP_SEQUENCE, 0, 0);
                    }, null);            }
            }
            private void btnSaveVideo_Click(object sender, EventArgs e)
            {
                try
                {
                    asyncOperation.Post(
                     delegate
                     {
                         SendMessage(hwndc, WM_CAP_STOP, 0, 0);
                     }, null
                     );            }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
    我想是我理解错了,还是卡。接着需要怎么做?麻烦高手们。自己太菜。
    如需代码,可发邮箱上来。我发过去。谢谢。