Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
#Include "win32api.inc"
#Include "vfw.inc"
Function PBMain () As Long
Local hDlg As Dword
Dialog New Pixels, 0, "TestDlg", 0, 0, 1920, 1080, %WS_SysMenu Or %DS_Center To hDlg
Dialog Show Modal hDlg Call CBProc
End Function
CallBack Function CBProc
Local w,h As Long
Static hCap As Dword
Select Case As Long Cb.Msg
Case %WM_Destroy
sendmessage hCap, %WM_CAP_DRIVER_DISCONNECT, 0, 0
Case %WM_InitDialog
hcap = capCreateCaptureWindow("Test CapWindow", ByVal (%WS_Child Or %WS_Visible), ByVal 0, ByVal 0, ByVal 1920, ByVal 1080, ByVal Cb.Hndl, ByVal 1001)
SendMessage hCap, %WM_CAP_DRIVER_CONNECT, 0, 0
SendMessage hCap, %WM_CAP_SET_SCALE, %True, 0
SendMessage hCap, %WM_CAP_SET_PREVIEWRATE, 30, 0
SendMessage hCap, %WM_CAP_SET_PREVIEW, %True, 0
Local B As BitMapInfo
w = 320 : h = 240
' w = 1920 : h = 1080
capGetVideoFormat hCap, VarPtr(B), SizeOf(B)
B.bmiHeader.biWidth = w
B.bmiHeader.biHeight = h
B.bmiHeader.biSizeImage = w * h * 3
capSetVideoFormat hCap, VarPtr(B), SizeOf(B)
End Select
End Function
http://www.garybeene.com/sw/gbsnippets.htm