Jump to content

Slider control problem


Recommended Posts

Hello !

I tried to create 2 slider to set the state of video in my script :

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SliderConstants.au3>
#include <DSEngine.au3>

Global $MovieGUI, $VideoPlay, $VideoStop, $VideoOpen, $VideoPos, $VideoVol, $ViewerVideo, $VideoPos2
Global $mVol, $mLength, $mVideoPlaying

$MovieGUI = GUICreate("Movie Player", 740, 590, -1, -1, -1)
$VideoPlay = GUICtrlCreateButton("PLAY", 20, 520, 100, 50)
$VideoStop = GUICtrlCreateButton("STOP", 140, 520, 100, 50)
$VideoOpen = GUICtrlCreateButton("OPEN", 260, 520, 100, 50)
$VideoSlow = GUICtrlCreateButton("SLOW", 380, 520, 100, 50)
$VideoSpeed = GUICtrlCreateButton("SPEED", 500, 520, 100, 50)
$VideoPos = GUICtrlCreateSlider(20, 490, 660, 25, $TBS_ENABLESELRANGE)
$ViewerVideo = GUICreate("", 660, 400, 20, 70, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_DISABLED, $WS_EX_MDICHILD), $MovieGUI)
$VideoPos2 = GUICtrlCreateSlider(0, 380, 660, 25, $TBS_ENABLESELRANGE)
GUICtrlSetBkColor(-1, 0x0)
GUISetBkColor(0, $ViewerVideo)
WinSetTrans($ViewerVideo, "", 220)
GUISetState(@SW_SHOW, $ViewerVideo)
GUISetState(@SW_SHOW, $MovieGUI)

While 1
$MSG = GUIGetMsg()
Switch $MSG
Case $GUI_EVENT_CLOSE
Exit
Case $VideoOpen
$PathVideo = FileOpenDialog("Open Video", "", "All Video(*.Avi;*.Wmp;*.Mkv;*.Flv;*.Mp4;*.Mpg;*.Ts)|All File(*.*)|Video(*.Avi; *.Wmp)", 1 + 4)
PlayVideo($PathVideo)
EndSwitch

If $mVideoPlaying = True Then
;~ GUICtrlSetState($VideoPos2, $GUI_ONTOP)
;
Switch $MSG
Case $VideoStop
Engine_StopPlayback()
GUICtrlSetData($VideoPos, Engine_GetLength())
GUISetBkColor(0x00000, $ViewerVideo)
WinSetTrans($ViewerVideo, "", 220)
Case $VideoPlay
Switch GUICtrlRead($VideoPlay)
Case "PLAY"
Engine_PausePlayback()
GUICtrlSetData($VideoPlay, "PAUSE")
Case "PAUSE"
Engine_StartPlayback()
GUICtrlSetData($VideoPlay, "PLAY")
EndSwitch
Case $VideoSpeed
;
Case $VideoSlow
;
EndSwitch
;
$mGGCI = GUIGetCursorInfo($MovieGUI)
If IsArray($mGGCI) And $mGGCI[4] = $VideoPos And $mGGCI[2] = 1 Then
While $mGGCI[2]
$mGGCI = GUIGetCursorInfo($MovieGUI)
$mPos = GUICtrlRead($VideoPos)
Sleep(1)
WEnd
Engine_SetPosition($mPos)
EndIf

GUICtrlSetData($VideoPos, Engine_GetPosition())

GUICtrlSetData($VideoPos2, Engine_GetPosition())EndIf
WEnd

Func PlayVideo($SavePath)
If $SavePath <> "" Then
Global $mVol = GUICtrlRead($VideoVol)
Engine_LoadFile($SavePath, $ViewerVideo)
Engine_StartPlayback()
$mLength = Engine_GetLength()
GUICtrlSetLimit($VideoPos, $mLength, 0)

GUICtrlSetLimit($VideoPos2, $mLength, 0)$mVideoPlaying = True
EndIf
EndFunc ;==>PlayVideo

The slider 2 ($VideoPos2) is hidden while the film is screened, but I want it to be shown. Could you tell me how to do this ?

All answers are welcome.

DSEngine.zip

Edited by MrVietA2
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

×
×
  • Create New...