Verfasst: 13.12.2006 19:31
...oder eine Dokumentation?
Das deutsche PureBasic-Forum
https://www.purebasic.fr/german/
Code: Alles auswählen
IncludeFile "capture-inc.pb"
#WM_CAP_START = #WM_USER
#WM_CAP_SET_CALLBACK_ERROR = #WM_CAP_START + 2
#WM_CAP_SET_CALLBACK_STATUS = #WM_CAP_START + 3
#WM_CAP_SET_CALLBACK_YIELD = #WM_CAP_START + 4
#WM_CAP_SET_CALLBACK_FRAME = #WM_CAP_START + 5
#WM_CAP_SET_CALLBACK_VIDEOSTREAM = #WM_CAP_START + 6
#WM_CAP_SET_CALLBACK_WAVESTREAM = #WM_CAP_START + 7
#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_DLG_VIDEOFORMAT = #WM_CAP_START + 41
#WM_CAP_DLG_VIDEOSOURCE = #WM_CAP_START + 42
#WM_CAP_DLG_VIDEODISPLAY = #WM_CAP_START + 43
#WM_CAP_SET_PREVIEW = #WM_CAP_START + 50
#WM_CAP_SET_PREVIEWRATE = #WM_CAP_START + 52
#WM_CAP_GET_STATUS = #WM_CAP_START + 54
#WM_CAP_FILE_SAVEDIB = #WM_CAP_START + 25
#WM_CAP_SET_SCALE = #WM_CAP_START + 53
#WM_CAP_SET_CALLBACK_CAPCONTROL = #WM_CAP_START + 85
#WM_CAP_EDIT_COPY = #WM_CAP_START + 30
#WM_CAP_GRAB_FRAME = #WM_CAP_START+60
Open_Window_0()
OpenLibrary(0, "AVICAP32.DLL")
hRobby = CallFunction(0, "capCreateCaptureWindowA", "Test", #WS_VISIBLE + #WS_CHILD, 1, 1, 1, 1, hWnd, 0)
SendMessage_(hRobby, #WM_CAP_DRIVER_CONNECT, 0 , 0)
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_Event_Gadget
If GadgetID = #Button_0
SendMessage_(hRobby, #WM_CAP_GRAB_FRAME, 0 , 0)
SendMessage_(hRobby, #WM_CAP_EDIT_COPY, 0 , 0)
Link = GetClipboardImage(#PB_Clipboard_Image)
If Link <> 0
StartDrawing( WindowOutput(0) )
DrawImage(Link, 120,10,300, 280)
StopDrawing()
EndIf
EndIf
EndIf
Delay(1)
Until Event = #PB_Event_CloseWindow ; End of the event loop
SendMessage_(hRobby, #WM_CAP_SET_PREVIEW, 0, 0)
SendMessage_(hRobby, #WM_CAP_DRIVER_DISCONNECT, "Test", 0)
CloseWindow(0)
CloseLibrary(0)
End
;
Code: Alles auswählen
; PureBasic Visual Designer v3.92 build 1460
;- Window Constants
Global hWnd
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Button_0
EndEnumeration
Procedure Open_Window_0()
hWnd=OpenWindow(#Window_0, 0, 0, 450, 320, "Videocapture", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
CreateImage(#Window_0, 310, 300)
If CreateGadgetList(WindowID(0))
ButtonGadget(#Button_0, 15, 35, 70, 25, "schnapp")
EndIf
EndProcedure
Code: Alles auswählen
Global hWnd
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Frame3D_0
#Frame3D_1
#Button_0
EndEnumeration
Enumeration
#ImageGadget_0
EndEnumeration
Procedure Open_Window_0()
hWnd = OpenWindow(#Window_0, 0, 0, 780, 350,"test", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar)
CreateGadgetList(WindowID(0))
ButtonGadget(#Button_0, 20, 40, 65, 25, "schnapp")
EndProcedure
#WM_CAP_START = #WM_USER
#WM_CAP_SET_CALLBACK_ERROR = #WM_CAP_START + 2
#WM_CAP_SET_CALLBACK_STATUS = #WM_CAP_START + 3
#WM_CAP_SET_CALLBACK_YIELD = #WM_CAP_START + 4
#WM_CAP_SET_CALLBACK_FRAME = #WM_CAP_START + 5
#WM_CAP_SET_CALLBACK_VIDEOSTREAM = #WM_CAP_START + 6
#WM_CAP_SET_CALLBACK_WAVESTREAM = #WM_CAP_START + 7
#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_DLG_VIDEOFORMAT = #WM_CAP_START + 41
#WM_CAP_DLG_VIDEOSOURCE = #WM_CAP_START + 42
#WM_CAP_DLG_VIDEODISPLAY = #WM_CAP_START + 43
#WM_CAP_SET_PREVIEW = #WM_CAP_START + 50
#WM_CAP_SET_PREVIEWRATE = #WM_CAP_START + 52
#WM_CAP_GET_STATUS = #WM_CAP_START + 54
#WM_CAP_FILE_SAVEDIB = #WM_CAP_START + 25
#WM_CAP_SET_SCALE = #WM_CAP_START + 53
#WM_CAP_SET_CALLBACK_CAPCONTROL = #WM_CAP_START + 85
#WM_CAP_EDIT_COPY = #WM_CAP_START + 30
#WM_CAP_GRAB_FRAME = #WM_CAP_START+60
Open_Window_0()
OpenLibrary(0, "AVICAP32.DLL")
hRobby = CallFunction(0, "capCreateCaptureWindowA", "BLUBBER", #WS_VISIBLE + #WS_CHILD, 120, 30, 310, 300, hWnd, 0)
SendMessage_(hRobby, #WM_CAP_DRIVER_CONNECT, 0 , 0)
SendMessage_(hRobby, #WM_CAP_SET_SCALE , 1 , 0)
SendMessage_(hRobby, #WM_CAP_SET_PREVIEWRATE, 50, 0)
SendMessage_(hRobby, #WM_CAP_SET_PREVIEW, 1 , 0)
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
SendMessage_(hRobby, #WM_CAP_GRAB_FRAME, 0 , 0)
If Event = #PB_Event_Gadget
If GadgetID = #Button_0
SendMessage_(hRobby, #WM_CAP_GRAB_FRAME, 0 , 0)
SendMessage_(hRobby, #WM_CAP_EDIT_COPY, 0 , 0)
Link = GetClipboardImage(#PB_Clipboard_Image)
If Link <> 0
StartDrawing( WindowOutput(0) )
DrawImage(Link, 440,30,300, 300)
StopDrawing()
EndIf
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
SendMessage_(hRobby, #WM_CAP_SET_PREVIEW, 0, 0)
SendMessage_(hRobby, #WM_CAP_DRIVER_DISCONNECT, "BLUBBER", 0)
CloseWindow(0)
CloseLibrary(0)