資源簡介
C# 通用USB攝像頭編程

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Runtime.InteropServices;
namespace?CamTest
{
????//參考AVICap技術
????public?class?Cam
????{
????????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_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?IntPtr?hWndC;
????????private?IntPtr?mControlPtr;
????????private?bool?bWorkStart?=?false;
????????private?int?mWidth;
????????private?int?mHeight;
????????private?int?mLeft;
????????private?int?mTop;
????????///?
????????///?初始化顯示圖像
????????///?
????????///?控件的句柄?
????????///?開始顯示的左邊距?
????????///?開始顯示的上邊距?
????????///?要顯示的寬度?
????????///?要顯示的長度?
????????public?Cam(IntPtr?handle?int?left?int?top?int?width?int?height)??
????????{
????????????mControlPtr?=?handle;
????????????mWidth?=?width;
????????????mHeight?=?height;
????????????mLeft?=?left;
????????????mTop?=?top;
????????}
????????//?創建捕捉窗口
????????//HWND?VFWAPI?capCreateCaptureWindow(
????????//??????LPCSTR?lpszWindowName,//?捕捉窗口名字
????????//??????DWORD?dwstyle,//?捕捉窗口的風格
????????//??????int?x,//?窗口左上角x軸坐標
????????//??????int?y,//?窗口左上角y軸坐標
????????//??????int?nWidth,//?窗口的寬度
????????//??????int?nHeight,//?窗口的高度
????????//??????HWND?HWnd,//?父窗口句柄
????????//??????Int?nID//?捕捉窗口的ID號
????????//);
????????//如果該函數調用成功?則函數返回窗口的句柄?否則函數返回NULL。
????????[DllImport(“avicap32.dll“)]
????????private?static?extern?IntPtr?capCreateCaptureWindowA(byte[]?lpszWindowName?int?dwstyle?int?x?int?y?int?nWidth?int?nHeight?IntPtr?hWndParent?int?nID);
????//??????視頻格式設置對話框
????//????BOOL?capDlgVideoFormat(?hwnd?);?//?hwnd:捕捉窗
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????24576??2009-11-25?18:21??CamTest\CamTest\bin\Debug\CamTest.exe
?????文件???????5632??2005-11-11?22:25??CamTest\CamTest\bin\Debug\CamTest.vshost.exe
?????文件???????6047??2009-11-25?17:29??CamTest\CamTest\Cam.cs
?????文件???????3255??2009-11-25?14:53??CamTest\CamTest\CamTest.csproj
?????文件???????1670??2009-11-25?18:21??CamTest\CamTest\Form1.cs
?????文件???????5708??2009-11-25?18:15??CamTest\CamTest\Form1.Designer.cs
?????文件???????6008??2009-11-25?18:15??CamTest\CamTest\Form1.resx
?????文件????????268??2009-11-25?18:21??CamTest\CamTest\obj\CamTest.csproj.FileList.txt
?????文件????????842??2009-11-25?18:15??CamTest\CamTest\obj\Debug\CamTest.csproj.GenerateResource.Cache
?????文件??????24576??2009-11-25?18:21??CamTest\CamTest\obj\Debug\CamTest.exe
?????文件????????180??2009-11-25?18:15??CamTest\CamTest\obj\Debug\CamTest.Form1.resources
?????文件??????30208??2009-11-25?18:21??CamTest\CamTest\obj\Debug\CamTest.pdb
?????文件????????180??2009-11-25?14:50??CamTest\CamTest\obj\Debug\CamTest.Properties.Resources.resources
?????文件????????466??2009-11-25?14:47??CamTest\CamTest\Program.cs
?????文件???????1174??2009-11-25?14:47??CamTest\CamTest\Properties\AssemblyInfo.cs
?????文件???????2868??2009-11-25?14:47??CamTest\CamTest\Properties\Resources.Designer.cs
?????文件???????5612??2009-11-25?14:47??CamTest\CamTest\Properties\Resources.resx
?????文件???????1090??2009-11-25?14:47??CamTest\CamTest\Properties\Settings.Designer.cs
?????文件????????249??2009-11-25?14:47??CamTest\CamTest\Properties\Settings.settings
?????文件????????910??2009-11-25?14:48??CamTest\CamTest.sln
????..A..H.??????8192??2009-11-25?14:48??CamTest\CamTest.suo
?????文件??????27906??2009-11-25?15:50??CamTest\一種實現視頻捕捉的簡單方法.htm
?????目錄??????????0??2009-11-25?14:56??CamTest\CamTest\obj\Debug\Refactor
?????目錄??????????0??2009-11-25?14:47??CamTest\CamTest\obj\Debug\TempPE
?????目錄??????????0??2009-11-25?18:26??CamTest\CamTest\bin\Debug
?????目錄??????????0??2009-11-25?18:21??CamTest\CamTest\obj\Debug
?????目錄??????????0??2009-11-25?14:47??CamTest\CamTest\bin
?????目錄??????????0??2009-11-25?14:50??CamTest\CamTest\obj
?????目錄??????????0??2009-11-25?14:47??CamTest\CamTest\Properties
?????目錄??????????0??2009-11-25?18:21??CamTest\CamTest
............此處省略4個文件信息
評論
共有 條評論