Code: Select all
InitSprite()
UseJPEGImageEncoder()
UseJPEGImageDecoder()
#WM_CAP_START = #WM_USER
#WM_CAP_DRIVER_CONNECT = #WM_CAP_START + 10
#WM_CAP_DRIVER_DISCONNECT = #WM_CAP_START + 11
#WM_CAP_DRIVER_GET_CAPS = #WM_CAP_START + 14
#WM_CAP_EDIT_COPY = #WM_CAP_START + 30
#WM_CAP_DLG_VIDEOFORMAT = #WM_CAP_START + 41
#WM_CAP_DLG_VIDEOSOURCE = #WM_CAP_START + 42
#WM_CAP_DLG_VIDEODISPLAY = #WM_CAP_START + 43
#WM_CAP_GET_VIDEOFORMAT = #WM_CAP_START + 44
#WM_CAP_SET_VIDEOFORMAT = #WM_CAP_START + 45
#WM_CAP_DLG_VIDEOCOMPRESSION = #WM_CAP_START + 46
#WM_CAP_SET_OVERLAY = #WM_CAP_START + 51
#WM_CAP_GRAB_FRAME_NOSTOP = #WM_CAP_START + 61
#WM_CAP_STOP = #WM_CAP_START + 68
OpenWindow(0, 0, 0, 700, 270, "Server Preview", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SetWindowColor(0,RGB($00,$00,$00))
OpenWindowedScreen(WindowID(0),365,15,685,255,0,0,0)
If OpenLibrary(0, "avicap32.dll")
*capAddress = GetFunction(0, "capCreateCaptureWindowA")
hWndC.l = CallFunctionFast(*capAddress, "My Capture Window",#WS_CHILD | #WS_VISIBLE , 15, 15, 320, 240, WindowID(0),0)
SendMessage_(hWndC, #WM_CAP_DRIVER_CONNECT, 0, 0)
SendMessage_(hWndC, #WM_CAP_SET_OVERLAY, #True, 0)
EndIf
Repeat
event=WaitWindowEvent(1)
SendMessage_(hWndC, #WM_CAP_EDIT_COPY, 0, 0)
img = GetClipboardImage(#PB_Any)
If img
SaveImage(img,"c:\1.jpg",#PB_ImagePlugin_JPEG,5)
FreeImage(img)
Sprite = LoadSprite(#PB_Any, "c:\1.jpg");
DisplaySprite(Sprite,0,0)
FreeSprite(sprite)
EndIf
FlipBuffers()
Until event=#PB_Event_CloseWindow
If i hide the overlay window by removing "#WS_VISIBLE", it seems to work ok but i only get the resultant jpeg and not the overlay itself so it would seem, using overlay is the problem and not #WM_CAP_EDIT_COPY... my knowledge is too limited

