Jump to content

ProgDVB_Shot


ValeryVal
 Share

Recommended Posts

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:

#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

This script makes screen shot of DVBDream.

DVBDream home page

DVB Dream is a simple, easy, powerful and user-friendly DVB-Viewer application with the tools and options that make user's life easier

It 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:

#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
endfunc

Requirement:

You have to start DVBDream.

:(

The point of world view

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...