ValeryVal Posted April 5, 2010 Share Posted April 5, 2010 This script makes screen shot of ProgDVB. ProgDVB allows you to watch SAT-Television and listen to Radio channels directly from satellite by using DVB-PCI cards with hardware decoders ProgDVB_Shot.au3: expandcollapse popup#include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> Opt('MustDeclareVars', 1) Global $Msg, $hGUI, $Pic, $hPic, $CaptureButton, $SaveButton Global $hWnd, $size Global $FileSaved = @ScriptDir & "\ProgDVB.jpg" Global $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic, $width, $height $hWnd = WinGetHandle ("ProgDVB") $size = WinGetPos ($hWnd) ; Create GUI $hGUI = GUICreate("ProgDVB Shot", 800, 600) $CaptureButton = GUICtrlCreateButton("Capture", 40, 40, 110, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") $SaveButton = GUICtrlCreateButton("Save", 40, 70, 110, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") If FileExists($FileSaved) then $Pic = GUICtrlCreatePic($FileSaved, 190, 90, $size[2], $size[3]) $hPic = GUICtrlGetHandle ($Pic) endif ; Initialize GDI+ library _GDIPlus_Startup() GUISetState() While 1 $Msg = GUIGetMsg() switch $Msg case $GUI_EVENT_CLOSE ExitLoop case $CaptureButton Capture() case $SaveButton Save() endswitch WEnd ; Clean up resources _GDIPlus_ImageDispose($hImage2) _WinAPI_DeleteObject($hBitmap2) ; Shut down GDI+ library _GDIPlus_Shutdown() exit ;===================================== ; Capture ProgDVB image func Capture() Local $size While Not WinActive($hWnd) WinActivate($hWnd) Sleep(100) wend $hBitmap2 = _ScreenCapture_CaptureWnd("", $hWnd) Send("!{Tab}") $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2) ; Save resultant image _GDIPlus_ImageSaveToFile($hImage2, $FileSaved) if Not $hPic then $size = WinGetPos ($hWnd) $Pic = GUICtrlCreatePic($FileSaved, 190, 90, $size[2], $size[3]) $hPic = GUICtrlGetHandle ($Pic) endif GUICtrlSetImage ($Pic, $FileSaved) _GDIPlus_ImageDispose($hImage2) _WinAPI_DeleteObject($hBitmap2) endfunc ;===================================== ; Save ProgDVB Shot func Save() local $FileName, $DefaultName $DefaultName = "ProgDVB_" & @MON & "_" & @MDAY & "_" & @HOUR & "_" & @MIN & "_" & @SEC & ".jpg" $FileName = FileSaveDialog( "Choose a name.", @ScriptDir, "Image (*.jpg)", 2, $DefaultName) if not @error then FileCopy ($FileSaved, $FileName) endif endfunc Requirement: You have to start ProgDVB. The point of world view Link to comment Share on other sites More sharing options...
ValeryVal Posted April 6, 2010 Author Share Posted April 6, 2010 This script makes screen shot of DVBDream.DVBDream home pageDVB Dream is a simple, easy, powerful and user-friendly DVB-Viewer application with the tools and options that make user's life easierIt can make snapshot by Ctrl-J. It's pity that I failed to find this snapshot's file on my PC. It would be easy to write this DVBDream_Shot.au3:expandcollapse popup#include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <ScreenCapture.au3> #include <GuiTreeView.au3> #include <WinAPI.au3> Opt('MustDeclareVars', 1) Global $Msg, $hGUI, $Pic, $hPic, $CaptureButton, $SaveButton Global $hWnd, $size Global $FileSaved = @ScriptDir & "\DVBDream.jpg" Global $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic, $width, $height $size = WinGetPos ($hWnd) CheckState() ; Create GUI $hGUI = GUICreate("DVBDream Shot", 800, 600) $CaptureButton = GUICtrlCreateButton("Capture", 40, 40, 110, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") $SaveButton = GUICtrlCreateButton("Save", 40, 70, 110, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") If FileExists($FileSaved) then $Pic = GUICtrlCreatePic($FileSaved, 190, 90, $size[2], $size[3]) $hPic = GUICtrlGetHandle ($Pic) endif ; Initialize GDI+ library _GDIPlus_Startup() GUISetState() While 1 $Msg = GUIGetMsg() switch $Msg case $GUI_EVENT_CLOSE ExitLoop case $CaptureButton CheckState() Capture() case $SaveButton Save() endswitch WEnd ; Clean up resources _GDIPlus_ImageDispose($hImage2) _WinAPI_DeleteObject($hBitmap2) ; Shut down GDI+ library _GDIPlus_Shutdown() exit ;===================================== ; Check state of DVBDream window func CheckState() local $state If BitAnd(WinGetState("DVB Dream", ""), 2) then $hWnd = WinGetHandle ("DVB Dream") elseif BitAnd(WinGetState("ftvwindow", ""), 2) then $hWnd = WinGetHandle ("ftvwindow") elseif BitAnd(WinGetState("fvideo", ""), 2) then $hWnd = WinGetHandle ("fvideo") else MsgBox(0,"","You have to start DVBDream") exit EndIf endfunc ;===================================== ; Capture DVBDream image func Capture() Local $size While Not WinActive($hWnd) WinActivate($hWnd) wend $hBitmap2 = _ScreenCapture_CaptureWnd("", $hWnd) Send("!{Tab}") $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2) ; Save resultant image _GDIPlus_ImageSaveToFile($hImage2, $FileSaved) if Not $hPic then $size = WinGetPos ($hWnd) $Pic = GUICtrlCreatePic($FileSaved, 190, 90, $size[2], $size[3]) $hPic = GUICtrlGetHandle ($Pic) endif GUICtrlSetImage ($Pic, $FileSaved) _GDIPlus_ImageDispose($hImage2) _WinAPI_DeleteObject($hBitmap2) endfunc ;===================================== ; Save DVBDream Shot func Save() local $FileName, $DefaultName $DefaultName = "ProgDVB_" & @MON & "_" & @MDAY & "_" & @HOUR & "_" & @MIN & "_" & @SEC & ".jpg" $FileName = FileSaveDialog( "Choose a name.", @ScriptDir, "Image (*.jpg)", 2, $DefaultName) if not @error then FileCopy ($FileSaved, $FileName) endif endfuncRequirement:You have to start DVBDream. The point of world view Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now