Что нового

Как вставить видео с свой GUI

Arei

Скриптер
Сообщения
938
Репутация
115
у меня 2 кода

1 код
Код:
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('GUIOnEventMode',       1)
Opt('MustDeclareVars',      1)

OnAutoItExitRegister('_ProExit_Action')
HotKeySet('{ESC}', '_ProExit')

Global  $hWinMain, $hWinChild

;~ Главное окно (в нем будет рисунок)
$hWinMain   = GUICreate('Main win', 380, 180, -1, -1, $WS_OVERLAPPEDWINDOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_ProExit')

;~ Окно картинки
$hWinChild  = GUICreate('Child win', 380, 180, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP))

GUICtrlCreatePic(StringRegExpReplace(@AutoItExe, '(.+)\\.+', '\1') &'\Examples\GUI\logo4.gif', 20, 20, 169*2, 68*2)

GUISetState(@SW_SHOW, $hWinMain)
GUISetState(@SW_SHOW, $hWinChild)

;~ Рисование
_DrawPoint($hWinMain, 40, 40, 2,    '00d119')
_DrawPoint($hWinMain, 58, 64, 8,    'ff0000', 85)
_DrawPoint($hWinMain, 97, 84, 16,   'fffc00', 70)

#region Sleep...
While 1
    Sleep(10)
WEnd

Func _ProExit()
    Exit
EndFunc

Func _ProExit_Action()
;~ Код, который должен выполняться каждый раз при закрытии скрипта. Даже, если скрипт закрыт не через функцию _ProExit.
EndFunc
#endregion

;~ $hWin    - окно в котором рисовать
;~ $iX      - коррдината Х
;~ $iY      - коррдината Y
;~ $iWidth  - толщина точки
;~ $sRGB    - цвет в формате RRGGGBB
;~ $sAlpha  - прозрачность в процентах от 0 до 100
Func _DrawPoint($hWin, $iX, $iY, $iWidth=2, $sRGB='000000', $sAlpha='100')
    Local $hGraphic, $hPen

    ; Draw a polygon
    _GDIPlus_Startup()
    $hGraphic   = _GDIPlus_GraphicsCreateFromHWND($hWin)
    $hPen       = _GDIPlus_PenCreate('0x' & Hex((255*$sAlpha)/100, 2) & $sRGB, $iWidth)

    _GDIPlus_GraphicsDrawLine ($hGraphic, $iX, $iY, $iX+$iWidth, $iY, $hPen)

    ; Clean up resources
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc



2 код
Код:
$WM_CAP_START = 0x400
$WM_CAP_UNICODE_START = $WM_CAP_START +100
$WM_CAP_PAL_SAVEA = $WM_CAP_START + 81
$WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81
$WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW
$WM_CAP_ABORT = $WM_CAP_START + 69
$WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46
$WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43
$WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41
$WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42
$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_DRIVER_GET_NAMEA = $WM_CAP_START + 12
$WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12
$WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13
$WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13
$WM_CAP_EDIT_COPY = $WM_CAP_START + 30
$WM_CAP_END = $WM_CAP_UNICODE_END
$WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22
$WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21
$WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21
$WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23
$WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23
$WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25
$WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25
$WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20
$WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20
$WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24
$WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36
$WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1
$WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67
$WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67
$WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65
$WM_CAP_GET_STATUS = $WM_CAP_START + 54
$WM_CAP_GET_USER_DATA = $WM_CAP_START + 8
$WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44
$WM_CAP_GRAB_FRAME = $WM_CAP_START + 60
$WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61
$WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83
$WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84
$WM_CAP_PAL_OPENA = $WM_CAP_START + 80
$WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80
$WM_CAP_PAL_PASTE = $WM_CAP_START + 82
$WM_CAP_SEQUENCE = $WM_CAP_START + 62
$WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63
$WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35
$WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85
$WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2
$WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2
$WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5
$WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3
$WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3
$WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6
$WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7
$WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4
$WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66
$WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66
$WM_CAP_SET_OVERLAY = $WM_CAP_START + 51
$WM_CAP_SET_PREVIEW = $WM_CAP_START + 50
$WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52
$WM_CAP_SET_SCALE = $WM_CAP_START + 53
$WM_CAP_SET_SCROLL = $WM_CAP_START + 55
$WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64
$WM_CAP_SET_USER_DATA = $WM_CAP_START + 9
$WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45
$WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72
$WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71
$WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70
$WM_CAP_STOP = $WM_CAP_START + 68
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <ScreenCapture.au3>



 $avi = DllOpen("avicap32.dll")
$user = DllOpen("user32.dll")
$Main = GUICreate("Camera",250,230)

GUISetState()

$cap1 = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE), "int", 15, "int", 10, "int", 200, "int", 200, "hwnd", $Main, "int", 1)

DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0)
DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 1)
DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 1)
DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 1)
DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 1)
GUISetState(@SW_SHOW)


While 1
	$msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
      DllClose($user)
        Exit
    EndIf
    
Wend



Проблема в том что пытаюсь соединить выдаёт ошибку.Помогите пожалуйста.

Используемые библиотеки Webcam, _GDIPlus,WinAPIEx.Заранее спасибо.
 

`p r o x y

«Улыбайтесь, господа!»
Команда форума
Глобальный модератор
Сообщения
596
Репутация
157
Пример

Код:
$WM_CAP_START = 0x400
$WM_CAP_UNICODE_START = $WM_CAP_START +100
$WM_CAP_PAL_SAVEA = $WM_CAP_START + 81
$WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81
$WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW
$WM_CAP_ABORT = $WM_CAP_START + 69
$WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46
$WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43
$WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41
$WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42
$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_DRIVER_GET_NAMEA = $WM_CAP_START + 12
$WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12
$WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13
$WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13
$WM_CAP_EDIT_COPY = $WM_CAP_START + 30
$WM_CAP_END = $WM_CAP_UNICODE_END
$WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22
$WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21
$WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21
$WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23
$WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23
$WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25
$WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25
$WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20
$WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20
$WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24
$WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36
$WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1
$WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67
$WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67
$WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65
$WM_CAP_GET_STATUS = $WM_CAP_START + 54
$WM_CAP_GET_USER_DATA = $WM_CAP_START + 8
$WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44
$WM_CAP_GRAB_FRAME = $WM_CAP_START + 60
$WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61
$WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83
$WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84
$WM_CAP_PAL_OPENA = $WM_CAP_START + 80
$WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80
$WM_CAP_PAL_PASTE = $WM_CAP_START + 82
$WM_CAP_SEQUENCE = $WM_CAP_START + 62
$WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63
$WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35
$WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85
$WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2
$WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2
$WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5
$WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3
$WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3
$WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6
$WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7
$WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4
$WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66
$WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66
$WM_CAP_SET_OVERLAY = $WM_CAP_START + 51
$WM_CAP_SET_PREVIEW = $WM_CAP_START + 50
$WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52
$WM_CAP_SET_SCALE = $WM_CAP_START + 53
$WM_CAP_SET_SCROLL = $WM_CAP_START + 55
$WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64
$WM_CAP_SET_USER_DATA = $WM_CAP_START + 9
$WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45
$WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72
$WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71
$WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70
$WM_CAP_STOP = $WM_CAP_START + 68

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 		1)

Global $hAvi 		= DllOpen('avicap32.dll')
Global $hUser 		= DllOpen('user32.dll')

Global $hMainWin 	= GUICreate('Main', 	230, 225)
Global $hVideoWin 	= GUICreate('Camera', 	230, 225, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP), -1, $hMainWin)

GUISetState(@SW_SHOW, $hMainWin)
GUISetState(@SW_SHOW, $hVideoWin)

Global $hCap1 		= DllCall($hAvi, 'int', 'capCreateCaptureWindow', 'str', 'cap', 'int', BitOR($WS_CHILD, $WS_VISIBLE), 'int', 15, 'int', 10, 'int', 200, 'int', 200, 'hwnd', $hVideoWin, 'int', 1)

DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_DRIVER_CONNECT, 	'int', 0, 'int', 0)
DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_SET_SCALE, 			'int', 1, 'int', 1)
DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_SET_OVERLAY, 		'int', 1, 'int', 1)
DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_SET_PREVIEW, 		'int', 1, 'int', 1)
DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_SET_PREVIEWRATE, 	'int', 1, 'int', 1)

_DrawPoint($hMainWin, 40, 40, 2, 	'00d119')
_DrawPoint($hMainWin, 58, 64, 8, 	'ff0000', 85)
_DrawPoint($hMainWin, 97, 84, 16, 	'fffc00', 70)

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			DllClose($hUser)
			Exit
	EndSwitch
Wend

Func _DrawPoint($hWin, $iX, $iY, $iWidth=2, $sRGB='000000', $sAlpha='100')
	Local $hGraphic, $hPen

	; Draw a polygon
    _GDIPlus_Startup()
    $hGraphic 	= _GDIPlus_GraphicsCreateFromHWND($hWin)
	$hPen 		= _GDIPlus_PenCreate('0x' & Hex((255*$sAlpha)/100, 2) & $sRGB, $iWidth)

	_GDIPlus_GraphicsDrawLine ($hGraphic, $iX, $iY, $iX+$iWidth, $iY, $hPen)

    ; Clean up resources
	_GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc
 
Автор
A

Arei

Скриптер
Сообщения
938
Репутация
115
Но не нарисовалась.
 

`p r o x y

«Улыбайтесь, господа!»
Команда форума
Глобальный модератор
Сообщения
596
Репутация
157
тут уж надо с камерой тестить, у меня нрисовалось. А вот камеры нет.....
 
Автор
A

Arei

Скриптер
Сообщения
938
Репутация
115
Значит оно рисуется не поверх а вод ней.


Добавлено:
Сообщение автоматически объединено:

я соединил так.Но у меня то же поверх видео.
Код:
$WM_CAP_START = 0x400
$WM_CAP_UNICODE_START = $WM_CAP_START +100
$WM_CAP_PAL_SAVEA = $WM_CAP_START + 81
$WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81
$WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW
$WM_CAP_ABORT = $WM_CAP_START + 69
$WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46
$WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43
$WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41
$WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42
$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_DRIVER_GET_NAMEA = $WM_CAP_START + 12
$WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12
$WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13
$WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13
$WM_CAP_EDIT_COPY = $WM_CAP_START + 30
$WM_CAP_END = $WM_CAP_UNICODE_END
$WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22
$WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21
$WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21
$WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23
$WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23
$WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25
$WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25
$WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20
$WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20
$WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24
$WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36
$WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1
$WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67
$WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67
$WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65
$WM_CAP_GET_STATUS = $WM_CAP_START + 54
$WM_CAP_GET_USER_DATA = $WM_CAP_START + 8
$WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44
$WM_CAP_GRAB_FRAME = $WM_CAP_START + 60
$WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61
$WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83
$WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84
$WM_CAP_PAL_OPENA = $WM_CAP_START + 80
$WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80
$WM_CAP_PAL_PASTE = $WM_CAP_START + 82
$WM_CAP_SEQUENCE = $WM_CAP_START + 62
$WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63
$WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35
$WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85
$WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2
$WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2
$WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5
$WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3
$WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3
$WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6
$WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7
$WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4
$WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66
$WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66
$WM_CAP_SET_OVERLAY = $WM_CAP_START + 51
$WM_CAP_SET_PREVIEW = $WM_CAP_START + 50
$WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52
$WM_CAP_SET_SCALE = $WM_CAP_START + 53
$WM_CAP_SET_SCROLL = $WM_CAP_START + 55
$WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64
$WM_CAP_SET_USER_DATA = $WM_CAP_START + 9
$WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45
$WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72
$WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71
$WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70
$WM_CAP_STOP = $WM_CAP_START + 68


#region Include
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <ScreenCapture.au3>
#endregion

#region Opt
    Opt('GUIOnEventMode',       1)
    Opt('MustDeclareVars',      1)
	
#endregion

#region Pro
    OnAutoItExitRegister('_ProExit_Action')
    HotKeySet('{ESC}', '_ProExit')
#endregion

#region Global
    Global  $hWinMain, $hWinChild
#endregion

#region Главное окно (в нем будет рисунок)
    $hWinMain   = GUICreate('Main win', 380, 180, -1, -1, $WS_OVERLAPPEDWINDOW)
        GUISetOnEvent($GUI_EVENT_CLOSE, '_ProExit')
#endregion

#region Видео окно
  

  Local $avi, $user , $Main,$cap1,$msg
$avi = DllOpen("avicap32.dll")
$user = DllOpen("user32.dll")
$Main = GUICreate("Camera",250,230, 1689,778)

GUISetState()

$cap1 = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE), "int", 15, "int", 10, "int", 200, "int", 200, "hwnd", $Main, "int", 1)

DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0)
DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 1)
DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 1)
DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 1)
DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 1)
GUISetState(@SW_SHOW)
While 1
	$msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
      DllClose($user)
        Exit
    EndIf
    
  
Wend

#endregion

#region Start
    GUISetState(@SW_SHOW, $hWinMain)
    GUISetState(@SW_SHOW, $hWinChild)
#endregion

#region Рисование
    _DrawPoint($hWinMain, 40, 40, 2,    '00d119')
    _DrawPoint($hWinMain, 58, 64, 8,    'ff0000', 85)
    _DrawPoint($hWinMain, 97, 84, 16,   'fffc00', 70)
#endregion

#region Sleep...
While 1
    Sleep(10)
WEnd

Func _ProExit()
    Exit
EndFunc

Func _ProExit_Action()
;~ Код, который должен выполняться каждый раз при закрытии скрипта. Даже, если скрипт закрыт не через функцию _ProExit.
EndFunc
#endregion

;~ $hWin    - окно в котором рисовать
;~ $iX      - коррдината Х
;~ $iY      - коррдината Y
;~ $iWidth  - толщина точки
;~ $sRGB    - цвет в формате RRGGGBB
;~ $sAlpha  - прозрачность в процентах от 0 до 100
Func _DrawPoint($hWin, $iX, $iY, $iWidth=2, $sRGB='000000', $sAlpha='97')
    Local $hGraphic, $hPen

    ; Draw a polygon
    _GDIPlus_Startup()
    $hGraphic   = _GDIPlus_GraphicsCreateFromHWND($hWin)
    $hPen       = _GDIPlus_PenCreate('0x' & Hex((255*$sAlpha)/100, 2) & $sRGB, $iWidth)

    _GDIPlus_GraphicsDrawLine ($hGraphic, $iX, $iY, $iX+$iWidth, $iY, $hPen)

    ; Clean up resources
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc
 

`p r o x y

«Улыбайтесь, господа!»
Команда форума
Глобальный модератор
Сообщения
596
Репутация
157
Можно проверить, не создавать видео и будет видно.
 
Автор
A

Arei

Скриптер
Сообщения
938
Репутация
115
Но мне ведь надо поверх.
 

`p r o x y

«Улыбайтесь, господа!»
Команда форума
Глобальный модератор
Сообщения
596
Репутация
157
Arei [?]
я соединил так.Но у меня то же поверх видео.
Полная каша. Советую разобраться в создании GUI по справке.
 
Автор
A

Arei

Скриптер
Сообщения
938
Репутация
115
Но к сожалению работает так же как ваш.
 
Автор
A

Arei

Скриптер
Сообщения
938
Репутация
115
как мне рисовать поверх видео.а то только в этом запара.
 

`p r o x y

«Улыбайтесь, господа!»
Команда форума
Глобальный модератор
Сообщения
596
Репутация
157
Ну так действительно рисует под видео? Или что?
У меня, нет камеры, просто черный квадратик. И русется отлично поверх.
 
Автор
A

Arei

Скриптер
Сообщения
938
Репутация
115
да проверил 100% рисуется под видео.Вот пытаюсь,но не получается нарисовать над. я как понял т.к видео изменяется всё время то она просто стирается.
 

`p r o x y

«Улыбайтесь, господа!»
Команда форума
Глобальный модератор
Сообщения
596
Репутация
157
Хм, тогда стоит попробовать создать новое GUI окно, но не дочерное. И расположить его над окном с видео и в нем рисовать. Окна тогда вообще ни как не будут связаны и им будет параллейно. Главное, что бы во втором окне, если сделать его прозрачным, можно было бы рисовать....
 
Автор
A

Arei

Скриптер
Сообщения
938
Репутация
115
пример можно.А то с окнами плохо.
 

`p r o x y

«Улыбайтесь, господа!»
Команда форума
Глобальный модератор
Сообщения
596
Репутация
157
Есть вариант, как будет время, напишу...
 
Автор
A

Arei

Скриптер
Сообщения
938
Репутация
115
буду ждать.
 

`p r o x y

«Улыбайтесь, господа!»
Команда форума
Глобальный модератор
Сообщения
596
Репутация
157
Оооооооооооооочень "костыльный" вариант:

Код:
$WM_CAP_START = 0x400
$WM_CAP_UNICODE_START = $WM_CAP_START +100
$WM_CAP_PAL_SAVEA = $WM_CAP_START + 81
$WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81
$WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW
$WM_CAP_ABORT = $WM_CAP_START + 69
$WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46
$WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43
$WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41
$WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42
$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_DRIVER_GET_NAMEA = $WM_CAP_START + 12
$WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12
$WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13
$WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13
$WM_CAP_EDIT_COPY = $WM_CAP_START + 30
$WM_CAP_END = $WM_CAP_UNICODE_END
$WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22
$WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21
$WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21
$WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23
$WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23
$WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25
$WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25
$WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20
$WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20
$WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24
$WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36
$WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1
$WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67
$WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67
$WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65
$WM_CAP_GET_STATUS = $WM_CAP_START + 54
$WM_CAP_GET_USER_DATA = $WM_CAP_START + 8
$WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44
$WM_CAP_GRAB_FRAME = $WM_CAP_START + 60
$WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61
$WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83
$WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84
$WM_CAP_PAL_OPENA = $WM_CAP_START + 80
$WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80
$WM_CAP_PAL_PASTE = $WM_CAP_START + 82
$WM_CAP_SEQUENCE = $WM_CAP_START + 62
$WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63
$WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35
$WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85
$WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2
$WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2
$WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5
$WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3
$WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3
$WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6
$WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7
$WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4
$WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66
$WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66
$WM_CAP_SET_OVERLAY = $WM_CAP_START + 51
$WM_CAP_SET_PREVIEW = $WM_CAP_START + 50
$WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52
$WM_CAP_SET_SCALE = $WM_CAP_START + 53
$WM_CAP_SET_SCROLL = $WM_CAP_START + 55
$WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64
$WM_CAP_SET_USER_DATA = $WM_CAP_START + 9
$WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45
$WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72
$WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71
$WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70
$WM_CAP_STOP = $WM_CAP_START + 68

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <ScreenCapture.au3>
#Include <WinAPI.au3>

Opt('MustDeclareVars', 		1)
OnAutoItExitRegister('_ProExit_Action')

Global $hAvi 		= DllOpen('avicap32.dll')
Global $hUser 		= DllOpen('user32.dll')

Global $hMainWin 	= GUICreate('')
Global $hVideoWin 	= GUICreate('Camera', 	230, 225, -1, -1, $WS_POPUP, -1, $hMainWin)
	GUISetBkColor(0xABCDEF)

Global $hPicWin 	= GUICreate('Picture', 	224, 225)
	GUISetBkColor(0xABCDEF)
	GUISetStyle($WS_POPUP, $WS_EX_LAYERED, $hPicWin)
	_WinAPI_SetLayeredWindowAttributes($hPicWin, 0xABCDEF, 255)

GUICtrlCreateLabel('', 0, 0, 280, 20, -1, $GUI_WS_EX_PARENTDRAG)
	GUICtrlSetState(-1, $GUI_DISABLE)
	GUICtrlSetBkColor(-1, 0x5050A0)

GUICtrlCreateLabel('Title win', 5, 2, 200, 18, -1, $GUI_WS_EX_PARENTDRAG)
	GUICtrlSetBkColor(-1, 0x5050A0)
	GUICtrlSetFont(-1, 10, 700)
	GUICtrlSetColor(-1, 0xFFFFFF)

Global $hBtExit = GUICtrlCreateButton('X', 211, 1, 18, 18)
	GUICtrlSetState(-1, $GUI_NOFOCUS)

GUIRegisterMsg($WM_ACTIVATE,	'WM_ACTIVATE')
GUIRegisterMsg($WM_MOVE,		'WM_MOVE')
GUIRegisterMsg($WM_NCHITTEST, 	'WM_NCHITTEST')

GUISetState(@SW_SHOW, $hVideoWin)
GUISetState(@SW_SHOW, $hPicWin)

Local $aWinPos = WinGetPos($hVideoWin)
WinMove($hVideoWin, '', $aWinPos[0]+3, $aWinPos[1]+9)
WinActivate($hPicWin)

Global $hCap1 		= DllCall($hAvi, 'int', 'capCreateCaptureWindow', 'str', 'cap', 'int', BitOR($WS_CHILD, $WS_VISIBLE), 'int', 15, 'int', 11, 'int', 200, 'int', 200, 'hwnd', $hVideoWin, 'int', 1)
DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_DRIVER_CONNECT, 	'int', 0, 'int', 0)
DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_SET_SCALE, 			'int', 1, 'int', 1)
DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_SET_OVERLAY, 		'int', 1, 'int', 1)
DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_SET_PREVIEW, 		'int', 1, 'int', 1)
DllCall($hUser, 'int', 'SendMessage', 'hWnd', $hCap1[0], 'int', $WM_CAP_SET_PREVIEWRATE, 	'int', 1, 'int', 1)

_DrawPoint($hPicWin, 40, 40, 2, 	'00d119')
_DrawPoint($hPicWin, 58, 64, 8, 	'ff0000', 85)
_DrawPoint($hPicWin, 97, 84, 16, 	'fffc00', 70)

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
		Case $hBtExit
			Exit
	EndSwitch
Wend

Func _ProExit_Action()
	DllClose($hUser)
EndFunc

Func _DrawPoint($hWin, $iX, $iY, $iWidth=2, $sRGB='000000', $sAlpha='100')
	Local $hGraphic, $hPen

	; Draw a polygon
    _GDIPlus_Startup()
    $hGraphic 	= _GDIPlus_GraphicsCreateFromHWND($hWin)
	$hPen 		= _GDIPlus_PenCreate('0x' & Hex((255*$sAlpha)/100, 2) & $sRGB, $iWidth)

	_GDIPlus_GraphicsDrawLine ($hGraphic, $iX, $iY, $iX+$iWidth, $iY, $hPen)

    ; Clean up resources
	_GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc

Func WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam)
	If $hWnd <> $hVideoWin Then Return
	WinActivate($hPicWin)
EndFunc

Func WM_MOVE($hWnd, $Msg, $wParam, $lParam)
	If BitAnd(WinGetState($hWnd), 16) Then Return
	Local $aWinPos = WinGetPos($hWnd)
	If $hWnd == $hPicWin Then WinMove($hVideoWin, '', $aWinPos[0], $aWinPos[1]+20)
EndFunc

Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam)
	If $hWnd <> $hPicWin Then Return
	Local $iProc = DllCall('user32.dll', 'int', 'DefWindowProc', 'hwnd', $hWnd, 'int', $Msg, 'wparam', $wParam, 'lparam', $lParam)
	If $iProc[0] = $HTCLIENT Then Return $HTCAPTION
	Return $GUI_RUNDEFMSG
EndFunc


Советую избавиться при первой возможности.
 
Верх