ClassVedioCapture类代码using System;
using System.Runtime.InteropServices;namespace VideoControl
{
/// <summary>
/// VedioCapture 的摘要说明。
/// </summary>
public class ClassVedioCapture
{
        private const int WM_USER = 0x400;
        private const int WS_CHILD = 0x40000000;
        private const int WS_VISIBLE = 0x10000000;
        private const int WM_CAP_START = WM_USER;
        private const int WM_CAP_STOP = WM_CAP_START + 68;
        private const int WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;
        private const int WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;
        private const int WM_CAP_SAVEDIB = WM_CAP_START + 25;
        private const int WM_CAP_CUTIMAGE = 0x41e;        //剪切当前图像
        private const int WM_CAP_GRAB_FRAME = WM_CAP_START + 60;
        private const int WM_CAP_SEQUENCE = WM_CAP_START + 62;
        private const int WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;
        private const int WM_CAP_SEQUENCE_NOFILE = WM_CAP_START + 63;
        private const int WM_CAP_SET_OVERLAY = WM_CAP_START + 51;
        private const int WM_CAP_SET_PREVIEW = WM_CAP_START + 50;
        private const int WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6;
        private const int WM_CAP_SET_CALLBACK_ERROR = WM_CAP_START + 2;
        private const int WM_CAP_SET_CALLBACK_STATUSA = WM_CAP_START + 3;
        private const int WM_CAP_SET_CALLBACK_FRAME = WM_CAP_START + 5;
        private const int WM_CAP_SET_SCALE = WM_CAP_START + 53;
        private const int WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52;
        private const int WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41;
        private const int WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42;
        private const int WM_CAP_DLG_VIDEODISPLAY = WM_CAP_START + 43;
        private const int WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46; private int hCaptureM;
private bool isUnLoad = false;

public ClassVedioCapture()
{        
} ~ClassVedioCapture()
{
if( !isUnLoad )
{
this.UnLoad();
}
} [DllImport("avicap32.dll")]
private static extern int capCreateCaptureWindow( string strWindowName, int dwStyle, int x, int y ,int width, int height , int hwdParent, int nID );
[DllImport("user32.dll")]
private static extern int SendMessage( int hwnd , int wMsg, int wParam , int lParam );
        [DllImport("User32.dll")]
        private static extern bool SendMessage(int hWnd, int wMsg, int wParam, long lParam);
[DllImport("user32.dll")]
private static extern int SendMessage( int hwnd , int wMsg, int wParam , string lParam );
[DllImport("Kernel32.dll")]
private static extern bool CloseHandle( int hObject ); public bool Initialize( System.Windows.Forms.Control aContainer , int intWidth, int intHeight )
{
hCaptureM = capCreateCaptureWindow( "", 0x40000000 | 0x10000000, 0,0,intWidth,intHeight,aContainer.Handle.ToInt32() ,1 );
if( hCaptureM == 0 ) return false;
            
int ret = SendMessage( hCaptureM , 1034, 0,0 );
if( ret == 0 )
{
CloseHandle(hCaptureM);
return false;
}
//WM_CAP_SET_PREVIEW
ret = SendMessage( hCaptureM, 1074, 1, 0 );
if( ret == 0 )
{
this.UnLoad();
return false;
}
//WM_CAP_SET_SCALE
ret = SendMessage( hCaptureM, 1077, 1, 0 );
if( ret == 0 )
{
this.UnLoad();
return false;
}
//WM_CAP_SET_PREVIEWRATE
ret = SendMessage( hCaptureM, 1076, 66, 0 );
if( ret == 0 )
{
this.UnLoad();
return false;
}
return true;
} public void SingleFrameBegin()
{
//
int ret = SendMessage( hCaptureM, 1094 , 0, 0 );
}
public void SingleFrameEnd()
{
//
int ret = SendMessage( hCaptureM, 1095 , 0, 0 );
} public void SingleFrameMode()
{
//WM_CAP_GRAB_FRAME
int ret = SendMessage(  hCaptureM, 1084 , 0, 0 );
//WM_CAP_SET_PREVIEW 
//int ret = SendMessage(  hCaptureM, 1074 , 0, 0 );
//WM_CAP_SINGLE_FRAME
//ret = SendMessage( hCaptureM, 1096 , 0, 0 );
}
public void PreviewMode()
{
int ret = SendMessage( hCaptureM, 1074 , 1, 0 );
}         public void UnLoad()
{
int ret = SendMessage( hCaptureM, 1035, 0, 0 );
CloseHandle( this.hCaptureM );
isUnLoad = true;
} public void CopyToClipBorad()
{
int ret = SendMessage(  hCaptureM, 1054, 0, 0 );
} public void ShowFormatDialog()
{
int ret = SendMessage(  hCaptureM, 1065, 0, 0 );
}
public void SaveToDIB( string fileName )
{
int ret = SendMessage(  hCaptureM, 1049, 0, fileName );
} public void ShowDisplayDialog()
{
int ret = SendMessage( hCaptureM, 1067, 0, 0 );
} public System.Drawing.Image getCaptureImage()
{
System.Windows.Forms.IDataObject iData = System.Windows.Forms.Clipboard.GetDataObject();
System.Drawing.Image retImage = null;
if( iData !=  null ) 
{
if( iData.GetDataPresent( System.Windows.Forms.DataFormats.Bitmap ) )
{
retImage = (System.Drawing.Image)iData.GetData( System.Windows.Forms.DataFormats.Bitmap );

else if( iData.GetDataPresent( System.Windows.Forms.DataFormats.Dib  ) )
{
retImage = (System.Drawing.Image)iData.GetData( System.Windows.Forms.DataFormats.Dib );
}
}
return retImage;
}        // <summary>
        /// 录像
        /// </summary>
        /// <param name="path">要保存avi文件的路径</param>
        public void Kinescope(string path)
        {
            IntPtr hBmp = Marshal.StringToHGlobalAnsi(path);
            SendMessage(hCaptureM, WM_CAP_FILE_SET_CAPTURE_FILEA, 0, hBmp.ToInt64());
            SendMessage(hCaptureM, WM_CAP_SEQUENCE, 0, 0);
        }        /// <summary>
        /// 停止录像
        /// </summary>
        public void StopKinescope()
        {
            SendMessage(hCaptureM, WM_CAP_STOP, 0, 0);
        }
}
} 窗体调用代码using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;namespace VideoControl
{
    public partial class UserControl1 : UserControl
    {        /// <summary>
        /// 必需的设计器变量。
        /// </summary>        private ClassVedioCapture VC = new ClassVedioCapture();
        //private VideoTest VcTest = new VideoTest();
        private PublicClass VCimage = new PublicClass();        public UserControl1()
        {
            InitializeComponent();
        }        private void UserControl1_Load(object sender, EventArgs e)
        {
            this.pictureBox.Top = 25;
            this.pictureBox.Left = 0;
            this.TimetoolStripStatusLabel.Text = "当前时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }        private void PlaytoolStripLabel_Click(object sender, EventArgs e)
        {
            try
            {
                VC.Initialize(this.pictureBox, this.pictureBox.Width, this.pictureBox.Height);
                ActiontoolStripStatusLabel.Text = "视频运行";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }        private void StopStripLabel_Click(object sender, EventArgs e)
        {
            VC.UnLoad();
            ActiontoolStripStatusLabel.Text = "视频停止";
        }        private void UserControl1_Resize(object sender, EventArgs e)
        {
            this.pictureBox.Width = this.Width;
            this.pictureBox.Height = this.Height - 47;
        }        private void SuspendtoolStripLabel_Click(object sender, EventArgs e)
        {
            //PlaytoolStripLabel.Enabled = true;
            //SuspendtoolStripLabel.Enabled = false;
            //StopStripLabel.Enabled = true;
            VC.ShowDisplayDialog();
        }        private void NowTime_Tick(object sender, EventArgs e)
        {
            this.TimetoolStripStatusLabel.Text = "当前时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }        private void CapturetoolStripLabel_Click(object sender, EventArgs e)
        {
            VC.CopyToClipBorad();
            VCimage.Autosave(VC.getCaptureImage());
        }        private void VideotoolStripLabel_Click(object sender, EventArgs e)
        //开始录像,录像过程中鼠标成漏斗形,对着图像显示区域单击鼠标左键或右键就结束了录像。
        {
            try
            {
                VC.Initialize(this.pictureBox, this.pictureBox.Width, this.pictureBox.Height);
                ActiontoolStripStatusLabel.Text = "视频运行";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            string Opath = System.Windows.Forms.Application.StartupPath; //@"D:\VedioCapture\Photo";
            //Opath = Opath.Substring(0, Opath.LastIndexOf(@"\")); //去掉/后面的程序名
            string photoname = DateTime.Now.Ticks.ToString();
            if (Opath.Substring(Opath.Length - 1, 1) != @"\")
                Opath = Opath + @"\";
            string path1 = Opath + DateTime.Now.ToShortDateString();
            if (!Directory.Exists(path1))
                Directory.CreateDirectory(path1);
            ActiontoolStripStatusLabel.Text = "视频录像开始";
            VC.Kinescope(path1 + "\\" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + ".avi");
            ActiontoolStripStatusLabel.Text = "视频录像运行";
        }        private void StopVideotoolStripLabel_Click(object sender, EventArgs e)
        {
            VC.StopKinescope();
            VC.UnLoad();
            ActiontoolStripStatusLabel.Text = "视频停止";
        }
    }
}问题:在点击录像按钮的时候录像过程中鼠标成漏斗形,对着图像显示区域单击鼠标左键或右键就结束了录像。
如何取消这种效果,能让它一直录像,直到我点击停止录像再进行录像呢?我估计我这种调用方式有问题,希望能给出具体的代码或者解决方案