一。类
public class VideoAPI
{
[DllImport("avicap32.dll")]
public static extern IntPtr capCreateCaptureWindowA(byte[] lpszWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, int nID);
[DllImport("avicap32.dll")]
public static extern bool capGetDriverDescriptionA(short wDriver, byte[] lpszName, int cbName, byte[] lpszVer, int cbVer);
[DllImport("User32.dll")]
public static extern bool SendMessage(IntPtr hWnd, int wMsg, bool wParam, int lParam);
[DllImport("User32.dll")]
public static extern bool SendMessage(IntPtr hWnd, int wMsg, short wParam, int lParam);
[DllImport("user32")]
public static extern bool DestroyWindow(IntPtr hWnd);
#region
// // 开始定义消息参数 整数型
const avicap32='avicap32.dll';
//public const int WM_CAP_START= WM_USER=1024;
start of unicode messages
//public const int WM_CAP_UNICODE_START= WM_USER+100; //开始
//public const int WM_CAP_GET_CAPSTREAMPTR= (WM_CAP_START+ 1); //获得 CAPSTR EAMPTR
//public const int WM_CAP_SET_CALLBACK_ERROR= (WM_CAP_START+ 2); //设置收回错误
//public const int WM_CAP_SET_CALLBACK_STATUS= (WM_CAP_START+ 3); //设置收回状态
public const int WM_CAP_SET_CALLBACK_YIELD = (WM_CAP_START + 4); //设置收回出产
public const int WM_CAP_SET_CALLBACK_FRame = (WM_CAP_START + 5); //设置收回结构
//public const int WM_CAP_SET_CALLBACK_VIDEOSTREAM = (WM_CAP_START + 6); //设置收回视频流
public const int WM_CAP_SET_CALLBACK_WAVESTREAM = (WM_CAP_START + 7); //设置收回视频波流
public const int WM_CAP_GET_USER_DATA = (WM_CAP_START + 8); //获得使用者数据
public const int WM_CAP_SET_USER_DATA = (WM_CAP_START + 9); //设置使用者数据
//public const int WM_CAP_DRIVER_CONNECT =(WM_CAP_START+ 10); //驱动程序连接
//public const int WM_CAP_DRIVER_DISCONNECT =(WM_CAP_START+ 11); //断开启动程序连接
//public const int WM_CAP_DRIVER_GET_NAME =(WM_CAP_START+ 12); //获得驱动程序名字
//public const int WM_CAP_DRIVER_GET_VERSION =(WM_CAP_START+ 13); //获得驱动程序版本
//public const int WM_CAP_DRIVER_GET_CAPS =(WM_CAP_START+ 14); //获得驱动程序帽子
//public const int WM_CAP_FILE_SET_CAPTURE_FILE =(WM_CAP_START+ 20); //设置捕获文件
//public const int WM_CAP_FILE_GET_CAPTURE_FILE =(WM_CAP_START+ 21); //获得捕获文件
//public const int WM_CAP_FILE_SAVEAS =(WM_CAP_START+ 23); //另存文件为
//public const int WM_CAP_FILE_SAVEDIB =(WM_CAP_START+ 25); //保存文件
out of order to save on ifdefs
//public const int WM_CAP_FILE_ALLOCATE =(WM_CAP_START+ 22); //分派文件
//public const int WM_CAP_FILE_SET_INFOCHUNK =(WM_CAP_START+