Revolter Posted December 6, 2010 Share Posted December 6, 2010 (edited) $mp3gui = GUICreate( "Mp3 Player v1.4" , 220 , 140 ) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_MINIMIZE Opt( "TrayOnEventMode" , 1 ) GUISetState( @SW_HIDE , $mp3gui ) TraySetOnEvent( $TRAY_EVENT_PRIMARYDOUBLE , "guirestore" ) TraySetOnEvent( $TRAY_EVENT_PRIMARYUP , "pause" ) EndSelect WEnd Func guirestore() GUISetState( @SW_SHOW , $mp3gui ) Opt( "TrayOnEventMode" , 0 ) SoundSetWaveVolume( 0 ) pause() pause() SoundSetWaveVolume( $volume ) EndFunc and the pause() func pauses the song now if i double click the tray icon when the song is paused the gui shows up but i can hear the song for a couple of miliseconds. how could i make it not to do that? Edited December 7, 2010 by Revolter [center]Sorry for my bad english. Trying my best :Dhttp://iulianonofrei.comhttp://www.last.fm/user/Revolt666 [/center] Link to comment Share on other sites More sharing options...
enaiman Posted December 6, 2010 Share Posted December 6, 2010 Opt( "TrayOnEventMode" , 1 ) - usually sits on top of the script, one of the very first lines after #include TraySetOnEvent( $TRAY_EVENT_PRIMARYDOUBLE , "guirestore" ) TraySetOnEvent( $TRAY_EVENT_PRIMARYUP , "pause" ) - these two it is recomended to be put in the main script (unless really needed otherwise) and not on the main loop. Move their location according to what I told you and I'm pretty sure the problem will be solved. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Revolter Posted December 7, 2010 Author Share Posted December 7, 2010 Opt( "TrayOnEventMode" , 1 )- usually sits on top of the script, one of the very first lines after #include TraySetOnEvent( $TRAY_EVENT_PRIMARYDOUBLE , "guirestore" )TraySetOnEvent( $TRAY_EVENT_PRIMARYUP , "pause" )- these two it is recomended to be put in the main script (unless really needed otherwise) and not on the main loop.Move their location according to what I told you and I'm pretty sure the problem will be solved.sorry i forgot to tell ... i also use tray items so if i use Opt( "TrayOnEventMode" , 1 ) i can't receive msgs from the tray items thats why i disable and enable oneventmode option [center]Sorry for my bad english. Trying my best :Dhttp://iulianonofrei.comhttp://www.last.fm/user/Revolt666 [/center] Link to comment Share on other sites More sharing options...
James Posted December 7, 2010 Share Posted December 7, 2010 #include <GUIConstants.au3> #include <Constants.au3> Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1) $mp3gui = GUICreate("Mp3 Player v1.4", 220, 140) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE, $mp3gui) TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "guirestore") TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "pause") Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func guirestore() GUISetState(@SW_SHOW, $mp3gui) Opt("TrayOnEventMode", 0) ;~ SoundSetWaveVolume(0) ;~ pause() ;~ pause() ;~ SoundSetWaveVolume($volume) EndFunc ;==>guirestore Func pause() MsgBox(0, "", "Pause") EndFuncPlease include all of your code, I'm sick of writing the rest of what you have missed out. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Revolter Posted December 7, 2010 Author Share Posted December 7, 2010 #include <GUIConstants.au3> #include <Constants.au3> Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1) $mp3gui = GUICreate("Mp3 Player v1.4", 220, 140) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE, $mp3gui) TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "guirestore") TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "pause") Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func guirestore() GUISetState(@SW_SHOW, $mp3gui) Opt("TrayOnEventMode", 0) ;~ SoundSetWaveVolume(0) ;~ pause() ;~ pause() ;~ SoundSetWaveVolume($volume) EndFunc ;==>guirestore Func pause() MsgBox(0, "", "Pause") EndFunc Please include all of your code, I'm sick of writing the rest of what you have missed out. the entire code has 700 lines :| i also use "Opt( "TrayMenuMode" , 1 )" and a couple of "Case $msg=..." and if i use traysetonevent the other trayitems won't work ... anyway i used sleep( 200 ) in the pause function and it works ... thanks for all your help ! [center]Sorry for my bad english. Trying my best :Dhttp://iulianonofrei.comhttp://www.last.fm/user/Revolt666 [/center] Link to comment Share on other sites More sharing options...
James Posted December 7, 2010 Share Posted December 7, 2010 the entire code has 700 lines :|i also use "Opt( "TrayMenuMode" , 1 )" and a couple of "Case $msg=..." and if i use traysetonevent the other trayitems won't work ... anyway i used sleep( 200 ) in the pause function and it works ... thanks for all your help ! Well how about you make a cut down version that actually works. THIS MEANS INCLUDES TOO! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Revolter Posted December 7, 2010 Author Share Posted December 7, 2010 Well how about you make a cut down version that actually works. THIS MEANS INCLUDES TOO!i have already solved it. thanks [center]Sorry for my bad english. Trying my best :Dhttp://iulianonofrei.comhttp://www.last.fm/user/Revolt666 [/center] 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