分享
 
 
 

偶写C#

王朝软件设计·作者佚名  2005-04-27
窄屏简体版  字體: |||超大  

一段代码~视频捕捉

using System;

using System.Text;

using System.Windows.Forms;

using System.Drawing;

using System.Runtime.InteropServices;

namespace VideoCap

{

/// <summary>

/// API 的摘要说明。

/// </summary>

public class API

{

public const int WS_BORDER = 0x800000;

public const int WS_CAPTION = 0xC00000;

public const int WS_SYSMENU = 0x80000;

public const int WS_CHILD = 0x40000000;

public const int WS_VISIBLE = 0x10000000;

public const int WS_OVERLAPPED = 0x0;

public const int WS_MINIMIZEBOX = 0x20000;

public const int WS_MAXIMIZEBOX = 0x10000;

public const int WS_THICKFRAME = 0x40000;

//public const int WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX);

public const int SWP_NOMOVE = 0x2;

public const int SWP_NOSIZE = 1;

public const int SWP_NOZORDER = 0x4;

public const int HWND_BOTTOM = 1;

public const int HWND_TOPMOST = -1;

public const int HWND_NOTOPMOST = -2;

public const int SM_CYCAPTION = 4;

public const int SM_CXFRAME = 32;

public const int SM_CYFRAME = 33;

public const int WS_EX_TRANSPARENT = 0x20;

public const int GWL_STYLE = (-16);

public const int WM_USER = 0x400;

public const int WM_CAP_START = WM_USER;

public const int WM_CAP_GET_CAPSTREAMPTR = WM_CAP_START + 1;

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_ALLOCATE = WM_CAP_START + 22;

public const int WM_CAP_FILE_SAVEAS = WM_CAP_START + 23;

public const int WM_CAP_FILE_SET_INFOCHUNK = WM_CAP_START + 24;

public const int WM_CAP_FILE_SAVEDIB = WM_CAP_START + 25;

public const int WM_CAP_EDIT_COPY = WM_CAP_START + 30;

public const int WM_CAP_SET_AUDIOFORMAT = WM_CAP_START + 35;

public const int WM_CAP_GET_AUDIOFORMAT = WM_CAP_START + 36;

public const int WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41;

public const int WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42;

public const int WM_CAP_DLG_VIDEODISPLAY = WM_CAP_START + 43;

public const int WM_CAP_GET_VIDEOFORMAT = WM_CAP_START + 44;

public const int WM_CAP_SET_VIDEOFORMAT = WM_CAP_START + 45;

public const int WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46;

public const int WM_CAP_SET_PREVIEW = WM_CAP_START + 50;

public const int WM_CAP_SET_OVERLAY = WM_CAP_START + 51;

public const int WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52;

public const int WM_CAP_SET_SCALE = WM_CAP_START + 53;

public const int WM_CAP_GET_STATUS = WM_CAP_START + 54;

public const int WM_CAP_SET_SCROLL = WM_CAP_START + 55;

public const int WM_CAP_GRAB_FRAME = WM_CAP_START + 60;

public const int WM_CAP_GRAB_FRAME_NOSTOP = WM_CAP_START + 61;

public const int WM_CAP_SEQUENCE = WM_CAP_START + 62;

public const int WM_CAP_SEQUENCE_NOFILE = WM_CAP_START + 63;

public const int WM_CAP_SET_SEQUENCE_SETUP = WM_CAP_START + 64;

public const int WM_CAP_GET_SEQUENCE_SETUP = WM_CAP_START + 65;

public const int WM_CAP_SET_MCI_DEVICE = WM_CAP_START + 66;

public const int WM_CAP_GET_MCI_DEVICE = WM_CAP_START + 67;

public const int WM_CAP_STOP = WM_CAP_START + 68;

public const int WM_CAP_ABORT = WM_CAP_START + 69;

public const int WM_CAP_SINGLE_FRAME_OPEN = WM_CAP_START + 70;

public const int WM_CAP_SINGLE_FRAME_CLOSE = WM_CAP_START + 71;

public const int WM_CAP_SINGLE_FRAME = WM_CAP_START + 72;

public const int WM_CAP_PAL_OPEN = WM_CAP_START + 80;

public const int WM_CAP_PAL_SAVE = WM_CAP_START + 81;

public const int WM_CAP_PAL_PASTE = WM_CAP_START + 82;

public const int WM_CAP_PAL_AUTOCREATE = WM_CAP_START + 83;

public const int WM_CAP_PAL_MANUALCREATE = WM_CAP_START + 84;

// Following added post VFW 1.1

public const int WM_CAP_SET_CALLBACK_CAPCONTROL = WM_CAP_START + 85;

// Defines end of the message range

public const int WM_CAP_END = WM_CAP_SET_CALLBACK_CAPCONTROL;

public API()

{

//

// TODO: 在此处添加构造函数逻辑

//

}

private const string avicap = "avicap32.dll";

// WaveOut calls

[DllImport(avicap)]

public static extern int capCreateCaptureWindow(string lpszWindowName,int dwStyle,int x,int y,int nWidth,int nHeight,IntPtr hWndParent, int nID);

[DllImport(avicap)]

public static extern bool capGetDriverDescription(int wDriver,StringBuilder lpszName ,int cbName,StringBuilder lpszVer,int cbVer);

[DllImport("User32.dll",EntryPoint="SendMessage")]

public static extern int SendMessage(

int hWnd, // handle to destination window

int Msg, // message

int wParam, // first message parameter

int lParam // second message

);

[DllImport("User32.dll",EntryPoint="SendMessage")]

public static extern int SendMessageS(

int hWnd, // handle to destination window

int Msg, // message

int wParam, // first message parameter

string lParam // second message

);

[DllImport("User32.dll",EntryPoint="SendMessage")]

public static extern int SendMessagePtr(

int hWnd, // handle to destination window

int Msg, // message

int wParam, // first message parameter

out CAPDRIVERCAPS lParam // second message

);

//Declare Function capCreateCaptureWindowA Lib "avicap32.dll" ( ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal x As Long,

//ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Integer, ByVal hWndParent As Long, ByVal nID As Long) As Long

//Declare Function capGetDriverDescriptionA Lib "avicap32.dll" ( ByVal wDriver As Integer, ByVal lpszName As String,

//ByVal cbName As Long, ByVal lpszVer As String, ByVal cbVer As Long) As Boolean

}

public struct CAPDRIVERCAPS

{

public int wDeviceIndex ; // Driver index in system.ini

public int fHasOverlay ; // Can device overlay?

public int fHasDlgVideoSource ; // Has Video source dlg?

public int fHasDlgVideoFormat ; // Has Format dlg?

public int fHasDlgVideoDisplay ; // Has External out dlg?

public int fCaptureInitialized ; // Driver ready to capture?

public int fDriverSuppliesPalettes ; // Can driver make palettes?

public int hVideoIn ; // Driver In channel

public int hVideoOut ; // Driver Out channel

public int hVideoExtIn ; // Driver Ext In channel

public int hVideoExtOut ; // Driver Ext Out channel

}

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有