This is an easy example that have this problem:
Code: Select all
If OpenWindow(0, 0, 0, 340, 260, "Video capture", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
If OpenLibrary(0, "avicap32.dll")
*capAddress = GetFunction(0, "capCreateCaptureWindowA")
hWndC = CallFunctionFast(*capAddress, 0, #WS_CHILD | #WS_VISIBLE, 10, 10, 320, 240, WindowID(0),1)
SendMessage_(hWndC, #WM_CAP_DRIVER_CONNECT, 0, 0)
SendMessage_(hWndC, #WM_CAP_SET_PREVIEW, #True, 0)
SendMessage_(hWndC, #WM_CAP_SET_PREVIEWRATE, 15, 0)
EndIf
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
SendMessage_(hWndC, #WM_CAP_STOP, 0, 0)
SendMessage_(hWndC, #WM_CAP_DRIVER_DISCONNECT, 0, 0)
DestroyWindow_(hWndC)
CloseLibrary(0)
End