Блин давно был топик в котором не помню кто ответил на мой вопрос.
А щас он удален. Так вот кто-нить знает как сделать захват изображения с тв-тюнера или веб-камеры?
(ключ.слова: WM_CAP_SEQUNCE, capCaptureCreateWindow и т.д.)
Const WM_CAP As Integer = &H400
Const WM_CAP_DRIVER_CONNECT As Long = WM_CAP + 10
Const WM_CAP_DRIVER_DISCONNECT As Long = WM_CAP + 11
Const WM_CAP_EDIT_COPY As Long = WM_CAP + 30
Const WM_CAP_SET_PREVIEW As Long = WM_CAP + 50
Const WM_CAP_SET_PREVIEWRATE As Long = WM_CAP + 52
Const WM_CAP_SET_SCALE As Long = WM_CAP + 53
Const WS_CHILD As Long = &H40000000
Const WS_VISIBLE As Long = &H10000000
Const SWP_NOMOVE As Long = &H2
Const SWP_NOSIZE As Integer = 1
Const SWP_NOZORDER As Integer = &H4
Const HWND_BOTTOM As Integer = 1
Dim iDevice As Long ' Current device ID
Dim hHwnd As Long ' Handle to preview window
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
Private 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
Private Declare Function DestroyWindow Lib "user32" (ByVal hndw As Long) As Boolean
Private 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
Private Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Long, _
ByVal lpszName As String, ByVal cbName As Long, ByVal lpszVer As String, _
ByVal cbVer As Long) As Boolean
and all i see in picturebox
Code:
Sub OpenPreviewWindow()
'
' Open Preview window in picturebox
'
hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 640, _
480, picCapture.hwnd, 0)
'
' Connect to device
'
If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then
'
'Set the preview scale
'
SendMessage hHwnd, WM_CAP_SET_SCALE, True, 0
'
'Set the preview rate in milliseconds
'
SendMessage hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0
'
'Start previewing the image from the camera
'
SendMessage hHwnd, WM_CAP_SET_PREVIEW, True, 0
'
' Resize window to fit in picturebox
'
SetWindowPos hHwnd, HWND_BOTTOM, 0, 0, picCapture.ScaleWidth, picCapture.ScaleHeight, _
SWP_NOMOVE Or SWP_NOZORDER
cmdSave.Enabled = True
cmdStop.Enabled = True
cmdStart.Enabled = False
Else
'
' Error connecting to device close window
'
DestroyWindow hHwnd
cmdSave.Enabled = False
End If
End Sub
Сейчас этот форум просматривают: Majestic-12 [Bot] и гости: 7