MciSendString ( "stop myvideo" ) $mystatus = "PAUSED" WinSetTitle ( $GUI, "", "Video Player - Paused" ) $pause = 1 Else _Play ( ) EndIf EndFunc MciSendString ( "stop myvideo" ) $mystatus = "PAUSED" WinSetTitle ( $GUI, "", "Video Player - Paused" ) $pause = 1 Else _Play ( ) EndIf EndFunc Edited by Dhilip MciSendString ( "open " & $file & " alias myvideo" ) _Play ( ) EndFunc Func _Pause ( ) If $pause = 0 Then
MciSendString ( "Close myvideo" ) $file = FileOpenDialog ( "OPEN", "", "Video (*.mp3 *.avi *.mpg)" ) $wintitle = stringsplit ( $file, "\" ) $wintitle = $wintitle ] $file = '"' & $file & '"' MciSendString ( "seek myvideo to start" ) $mystatus = "STOPPED" WinSetTitle ( $GUI, "", "Video Player - Stopped" ) EndFunc Func _Load ( ) MciSendString ( "play myvideo repeat" ) $mystatus = "PLAYING" WinSetTitle ( $GUI, "", "Video Player - Playing" ) EndFunc Func _Stop ( ) MciSendString ( "Close myvideo" ) Exit EndFunc Func _Play ( ) $pause = 0
Expand collapse popup #include Opt ( "WinTitleMatchMode", 2 ) Opt ( "OnExitFunc", "_exit" ) Opt ( "GuiOnEventMode", 1 ) Global $mystatus = "Paused" Global $pause = 0 Global $wintitle = "none" $GUI = GUICreate ( "Video Player - Idle", 300, 26, 0, 0 ) $Play = GUICtrlCreateButton ( "Play", 0, 0, 75, 25, 0 ) $Pause = GUICtrlCreateButton ( "Pause", 75, 0, 75, 25, 0 ) $Stop = GUICtrlCreateButton ( "Stop", 150, 0, 75, 25, 0 ) $Load = GUICtrlCreateButton ( "Load", 225, 0, 75, 25, 0 ) GUICtrlSetOnEvent ( $Play, "_Play" ) GUICtrlSetOnEvent ( $Pause, "_Pause" ) GUICtrlSetOnEvent ( $Stop, "_Stop" ) GUICtrlSetOnEvent ( $Load, "_Load" ) GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Exit" ) GUISetState ( ) While 1 Sleep ( 1000 ) Wend Func mciSendString ( $string ) Local $ret $ret = DllCall ( "winmm.dll", "int", "mciSendString", "str", $string, "str", "", "int", 65534, "hwnd", 0 ) If Not Then Return $ret EndFunc Func _Exit ( )