vb.net2010的教學(xué)視頻電驢資源里有很多
創(chuàng)新互聯(lián)是一家專業(yè)提供山南企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、HTML5建站、小程序制作等業(yè)務(wù)。10年已為山南眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)絡(luò)公司優(yōu)惠進(jìn)行中。
你可以去哪那下載。我看的很多視頻就是在電驢里的。
樓上的不要說(shuō)vb做不了,關(guān)鍵是你不會(huì)
這里有個(gè),可以看看
form1中加picture
Private Sub Form_Load()
Dim lpszName As String * 100
Dim lpszVer As String * 100
'創(chuàng)建視頻窗口
'讀取驅(qū)動(dòng)程序列表
capGetDriverDescriptionA 0, lpszName, 100, lpszVer, 100
'創(chuàng)建視頻窗口程序
lwndC = capCreateCaptureWindowA(lpszName, WS_CAPTION Or WS_THICKFRAME Or WS_VISIBLE Or WS_CHILD, -5, -30, Pic.Width, Pic.Height, Pic.hwnd, 0)
'把捕捉窗口連接到一個(gè)捕捉設(shè)備
If capDriverConnect(lwndC, 0) Then
' '來(lái)使預(yù)覽模式的縮放有效或者無(wú)效
capPreviewScale lwndC, True
'發(fā)送給捕捉窗口來(lái)設(shè)置在預(yù)覽模式下幀的顯示頻率
capPreviewRate lwndC, 66
'發(fā)送給捕捉窗口來(lái)使預(yù)覽模式有效或者失效
capPreview lwndC, True
'調(diào)整窗體的在小及顯示格式
SetWindowPos lwndC, HWND_BOTTOM, 0, 0, 430, 350, SWP_NOMOVE Or SWP_NOZORDER
End If
End Sub
module中代碼:
Public Const WS_BORDER = H800000
Public Const WS_CAPTION = HC00000
Public Const WS_SYSMENU = H80000
Public Const WS_CHILD = H40000000
Public Const WS_VISIBLE = H10000000
Public Const WS_OVERLAPPED = H0
Public Const WS_MINIMIZEBOX = H20000
Public Const WS_MAXIMIZEBOX = H10000
Public Const WS_THICKFRAME = H40000
Public Const WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)
Public Const SWP_NOMOVE = H2
Public Const SWP_NOSIZE = 1
Public Const SWP_NOZORDER = H4
Public Const HWND_BOTTOM = 1
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SM_CYCAPTION = 4
Public Const SM_CXFRAME = 32
Public Const SM_CYFRAME = 33
Public Const WS_EX_TRANSPARENT = H20
Public Const GWL_STYLE = (-16)
'為窗體設(shè)置值
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function lStrCpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As Long, ByVal lpString2 As Long) As Long
Declare Function lStrCpyn Lib "kernel32" Alias "lstrcpynA" (ByVal lpString1 As Any, ByVal lpString2 As Long, ByVal iMaxLength As Long) As Long
Declare Sub RtlMoveMemory Lib "kernel32" (ByVal hpvDest As Long, ByVal hpvSource As Long, ByVal cbCopy As Long)
Declare Sub hmemcpy Lib "kernel32" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
'這個(gè)函數(shù)為窗口指定個(gè)個(gè)新位置和狀態(tài)。它也可改變窗口在內(nèi)部窗口列表中的位置
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
'關(guān)閉窗體及子窗體
Declare Function DestroyWindow Lib "user32" (ByVal hndw As Long) As Boolean
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
'在結(jié)構(gòu)中為指定的窗口設(shè)置信息
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Public lwndC As Long '窗體句柄
Public Const HTCAPTION = 2
Public Const WM_NCLBUTTONDOWN = HA1
Public Declare Function ReleaseCapture Lib "user32" () As Long
'**********************************'保存窗口最前
Public Const WM_USER = H400 '偏移地址
Type POINTAPI
X As Long
Y As Long
End Type
'調(diào)用一個(gè)窗口的窗口函數(shù),將一條消息發(fā)給那個(gè)窗口。直到消息被處理完畢,該函數(shù)才會(huì)返回
'hwnd(long)要接收消息的那個(gè)窗口的句柄、 wmsg(long)消息的標(biāo)識(shí)符 、wparam(long)具體取決于消息 iparam(ANY)具體取決于消息
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Declare Function SendMessageS Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As String) As Long
Public Const WM_CAP_START = WM_USER '開(kāi)始址
Public Const WM_CAP_GET_CAPSTREAMPTR = WM_CAP_START + 1 '
Public Const WM_CAP_SET_CALLBACK_ERROR = WM_CAP_START + 2 '在程序設(shè)定當(dāng)發(fā)生錯(cuò)誤時(shí)調(diào)用的回調(diào)函數(shù)
Public Const WM_CAP_SET_CALLBACK_STATUS = WM_CAP_START + 3 '在程序中設(shè)定當(dāng)狀態(tài)改變時(shí)調(diào)用的回調(diào)函數(shù)
Public Const WM_CAP_SET_CALLBACK_YIELD = WM_CAP_START + 4 '在程序中設(shè)定當(dāng)程序讓位時(shí)調(diào)用的回調(diào)函數(shù)
Public Const WM_CAP_SET_CALLBACK_FRAME = WM_CAP_START + 5 '在程序中設(shè)定當(dāng)預(yù)覽幀被捕捉時(shí)調(diào)用的加調(diào)函數(shù)
Public Const WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6 '在程序中設(shè)定當(dāng)一個(gè)新的視頻緩沖區(qū)可以時(shí)調(diào)用的回調(diào)函數(shù)
Public Const WM_CAP_SET_CALLBACK_WAVESTREAM = WM_CAP_START + 7 '在程序中設(shè)定當(dāng)一個(gè)新的音頻緩沖區(qū)可以時(shí)調(diào)用的回調(diào)函數(shù)
Public Const WM_CAP_GET_USER_DATA = WM_CAP_START + 8 '把數(shù)據(jù)關(guān)聯(lián)到一個(gè)捕捉窗口,可以獲取一個(gè)長(zhǎng)整型數(shù)據(jù)
Public Const WM_CAP_SET_USER_DATA = WM_CAP_START + 9 '把數(shù)據(jù)關(guān)聯(lián)到一個(gè)捕捉窗口,'可以設(shè)置一個(gè)長(zhǎng)整型數(shù)據(jù)
Public Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10 '把捕捉窗口連接到一個(gè)捕捉設(shè)備
Public Const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11 ''用來(lái)斷開(kāi)捕捉驅(qū)動(dòng)器和捕捉窗口之間的連接
Public Const WM_CAP_DRIVER_GET_NAME = WM_CAP_START + 12 '連接到'來(lái)得到已連接到某個(gè)捕捉窗口的捕捉設(shè)備驅(qū)動(dòng)程序的名字
Public Const WM_CAP_DRIVER_GET_VERSION = WM_CAP_START + 13 '得到驅(qū)動(dòng)程序的版本號(hào)
Public Const WM_CAP_DRIVER_GET_CAPS = WM_CAP_START + 14 '來(lái)得到捕捉窗口的硬件的性能。
'捕捉文件和緩存
Public Const WM_CAP_FILE_SET_CAPTURE_FILE = WM_CAP_START + 20 '可以指定另一個(gè)路徑和文件名。這個(gè)消息指定文件名,但不創(chuàng)建文件,也不打開(kāi)文件或?yàn)槲募暾?qǐng)空間
Public Const WM_CAP_FILE_GET_CAPTURE_FILE = WM_CAP_START + 21 '來(lái)得到當(dāng)前的捕捉文件
Public Const WM_CAP_FILE_ALLOCATE = WM_CAP_START + 22 '為捕捉文件預(yù)分配空間,從而可以減少被漏掉的幀
Public Const WM_CAP_FILE_SAVEAS = WM_CAP_START + 23 '將捕捉文件保存為另一個(gè)用戶指定的文件。這個(gè)消息不會(huì)改變捕捉文件的名字和內(nèi)容,
'由于捕捉文件保留它最初的文件名,因此必須指定個(gè)新的文件的文件名來(lái)保存
Public Const WM_CAP_FILE_SET_INFOCHUNK = WM_CAP_START + 24 '可以把信息塊例如文本或者自定義數(shù)據(jù)插入avi文件。同樣用這個(gè)消息也可以清除avi文件中的信息塊
Public Const WM_CAP_FILE_SAVEDIB = WM_CAP_START + 25 '把從幀緩存中復(fù)制出圖像存為設(shè)備無(wú)關(guān)位圖書館(DIB),應(yīng)用程序也可以使用這兩個(gè)單幀捕捉消息來(lái)編輯幀序列,
'或者創(chuàng)建一個(gè)慢速攝影序列
Public Const WM_CAP_EDIT_COPY = WM_CAP_START + 30 '一旦捕捉到圖像,把緩存中圖像復(fù)制到剪貼板中
Public Const WM_CAP_SET_AUDIOFORMAT = WM_CAP_START + 35 '設(shè)置音頻格式。設(shè)置時(shí)傳入一個(gè)WAVEFORMAT、WAVEFORMATEX、或PCMWAVEOFMAT結(jié)構(gòu)的指針
Public Const WM_CAP_GET_AUDIOFORMAT = WM_CAP_START + 36 '來(lái)得到音頻數(shù)據(jù)的格式和該格式結(jié)構(gòu)體的大小。默認(rèn)的捕捉音頻格式是mono、8-bit和11kHZ PCM
Public Const WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41 '對(duì)數(shù)字化后的視頻幀的大小和圖像深度,以及被捕捉視頻的數(shù)據(jù)的壓縮方式的選擇
Public Const WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42 '視頻對(duì)話框,用來(lái)枚舉連接視頻源的捕捉卡的信號(hào)種類,并且
'控制顏色、對(duì)比度、飽和度的改變,如果視頻驅(qū)動(dòng)程序支技,可以用這個(gè)對(duì)話框
Public Const WM_CAP_DLG_VIDEODISPLAY = WM_CAP_START + 43 '視頻顯示對(duì)話框控制視頻捕捉過(guò)程中視頻在顯示器上的顯示。對(duì)捕捉數(shù)據(jù)無(wú)影響,但會(huì)影響數(shù)了信號(hào)表達(dá)式
Public Const WM_CAP_GET_VIDEOFORMAT = WM_CAP_START + 44 '給捕捉窗口來(lái)得到視頻格式的結(jié)構(gòu)和該結(jié)構(gòu)的大小。
Public Const WM_CAP_SET_VIDEOFORMAT = WM_CAP_START + 45 '用來(lái)設(shè)置視頻格式
Public Const WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46 ' 視頻壓縮對(duì)話框
Public Const WM_CAP_SET_PREVIEW = WM_CAP_START + 50 '發(fā)送給捕捉窗口來(lái)使預(yù)覽模式有效或者失效
Public Const WM_CAP_SET_OVERLAY = WM_CAP_START + 51 '使窗口處于疊加模式。使疊加模式有效也會(huì)自動(dòng)地使預(yù)覽模式失效
Public Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52 '發(fā)送給捕捉窗口來(lái)設(shè)置在預(yù)覽模式下幀的顯示頻率
Public Const WM_CAP_SET_SCALE = WM_CAP_START + 53 '來(lái)使預(yù)覽模式的縮放有效或者無(wú)效
Public Const WM_CAP_GET_STATUS = WM_CAP_START + 54 '得到捕捉窗口的當(dāng)前狀態(tài)
Public Const WM_CAP_SET_SCROLL = WM_CAP_START + 55 '如果是在預(yù)覽模式或者疊加模式,還可以通過(guò)本消息發(fā)送給窗口,
'在窗口里的用戶區(qū)域設(shè)置視頻幀的滾動(dòng)條的位置
'定義結(jié)束時(shí)響應(yīng)信息
Public Const WM_CAP_SET_CALLBACK_CAPCONTROL = WM_CAP_START + 85
Public Const WM_CAP_END = WM_CAP_SET_CALLBACK_CAPCONTROL
'// 導(dǎo)入avicap32.dll連接庫(kù)下的兩個(gè)函數(shù)
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
Function capDriverConnect(ByVal lwnd As Long, ByVal i As Integer) As Boolean
'把捕捉窗口連接到一個(gè)捕捉設(shè)備
capDriverConnect = SendMessage(lwnd, WM_CAP_DRIVER_CONNECT, i, 0)
End Function
Function capDriverDisconnect(ByVal lwnd As Long) As Boolean
''用來(lái)斷開(kāi)捕捉驅(qū)動(dòng)器和捕捉窗口之間的連接
capDriverDisconnect = SendMessage(lwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0)
End Function
Function capDriverGetName(ByVal lwnd As Long, ByVal szName As Long, ByVal wSize As Integer) As Boolean
'獲得驅(qū)動(dòng)程序名字
capDriverGetName = SendMessage(lwnd, YOURCONSTANTMESSAGE, wSize, szName)
End Function
Function capDriverGetCaps(ByVal lwnd As Long, ByVal s As Long, ByVal wSize As Integer) As Boolean
'來(lái)得到捕捉窗口的硬件的性能
capDriverGetCaps = SendMessage(lwnd, WM_CAP_DRIVER_GET_CAPS, wSize, s)
End Function
Function capPreview(ByVal lwnd As Long, ByVal f As Boolean) As Boolean
'發(fā)送給捕捉窗口來(lái)使預(yù)覽模式有效或者失效
capPreview = SendMessage(lwnd, WM_CAP_SET_PREVIEW, f, 0)
End Function
Function capPreviewRate(ByVal lwnd As Long, ByVal wMS As Integer) As Boolean
'發(fā)送給捕捉窗口來(lái)設(shè)置在預(yù)覽模式下幀的顯示頻率
capPreviewRate = SendMessage(lwnd, WM_CAP_SET_PREVIEWRATE, wMS, 0)
End Function
Function capPreviewScale(ByVal lwnd As Long, ByVal f As Boolean) As Boolean
'來(lái)使預(yù)覽模式的縮放有效或者無(wú)效
capPreviewScale = SendMessage(lwnd, WM_CAP_SET_SCALE, f, 0)
End Function
為啥不能顯示?我試過(guò),如果圖像文件的名字很奇怪,就不能顯示,VB 不支持它。你改個(gè)很一般的名字即可。圖像不需要用資源文件,用 ImageList 控件:
Me.BackGroundImage = 圖像列表.Images(0)
INSERT INTO 語(yǔ)句是插入新的行
如果你希望對(duì)已經(jīng)存在的記錄某些字段進(jìn)行更改,應(yīng)該用:
Update 語(yǔ)句
具體格式是:
UPDATE 表名稱 SET 列名稱 = 新值 WHERE 列名稱 = 某值
你修改這一句:
oleCmd.CommandText = "INSERT INTO TestImg (img) VALUES (@img)"
為:
oleCmd.CommandText = "UPDATE TestImg Set img = @img Where ID =1"