J'ai trafiqué des procédures car j'en trouvais certaines trop compliquées Pour moi, plus c'est simple plus j'ai de chances d'arriver au bout de mon programme

Je les mets là on sait jamais peut etre que ca sera utile a quelqun d'autre.
MCI_ReSize()
Code : Tout sélectionner
Procedure MCI_ReSize(Nb,x$,y$,width$,height$) ;Déplace/Redimensionne
i=mciSendString_("put MCI_"+Str(0)+" destination at "+x$+" "+y$+" "+width$+" "+height$,0,0,0)
ProcedureReturn i
EndProcedure
MCI_GetWidth() et MCI_GetHeight()
Code : Tout sélectionner
Procedure.s MCI_GetWidth(Nb) ; Renvoie la largeur du film
a$=Space(#MAX_PATH)
i=mciSendString_("where MCI_"+Str(Nb)+" source",@a$,#MAX_PATH,0)
ProcedureReturn StringField(a$,3," ")
EndProcedure
Code : Tout sélectionner
Procedure.s MCI_GetHeight(Nb) ; Renvoie la hauteur du film
a$=Space(#MAX_PATH)
i=mciSendString_("where MCI_"+Str(Nb)+" source",@a$,#MAX_PATH,0)
ProcedureReturn StringField(a$,4," ")
J'ai un probleme avec l'MCI, mon trackbargadget avance plus vite que la deconne et je pige pas pourquoi.
Voila le code, c'est pas tres bien rangé mais c'est parceque je n'ai pas fini.
Il faut la libtoolbarxp. Quand aux icones des boutons, elle sont
ici
Code : Tout sélectionner
IncludeFile "MCI_Procs.pb"
Structure SH_FILEINFO
hIcon.l
iIcon.l
dwAttributes.l
szDisplayName.b[#MAX_PATH]
szTypeName.b[80]
EndStructure
Global Play2 ;{
Play2 = CatchImage(0, ?Play2)
Global pause2
pause2 = CatchImage(1, ?pause2)
Global stop2
stop2 = CatchImage(2, ?stop2)
Global toolbarxp16 ;}
Enumeration
#pingtixplayer
#play
#pause
#stop
#volume
#MenuBar_0
#fouvrir
#fquitter
#cplay
#cpause
#cstop
#aapropos
#zx1demi
#zx1
#zx2
#zx3
#Statut
#play2
#fullscreen
#plus
#moins
#progression
#fcd
EndEnumeration
;-Procedures
Procedure resize()
;ResizeMovie(0,25,WindowWidth(),WindowHeight()-94)
MCI_ReSize(0,"0","25",Str(WindowWidth()),Str(WindowHeight()-94))
If tkbg=1
ResizeGadget(#progression,0,WindowHeight()-70,WindowWidth(),20)
EndIf
EndProcedure
Procedure.l ExtractSmallIconFile(IconPath.s)
SHGetFileInfo_(IconPath, 0, @InfosFile.SH_FILEINFO, SizeOf(SH_FILEINFO), #SHGFI_ICON | #SHGFI_SMALLICON)
ProcedureReturn InfosFile\hIcon
EndProcedure
Procedure Open_player()
If OpenWindow(#pingtixplayer,100,100,230,100, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget,"Pingtix Player");= 0 Or CreateGadgetList(WindowID()) = 0
If CreateMenu(#MenuBar_0, WindowID())
MenuTitle("Fichier")
MenuItem(#fouvrir, "Ouvrir")
MenuItem(#fcd,"CD audio")
MenuItem(#fquitter, "Quitter")
MenuTitle("Contrôle")
MenuItem(#cplay, "Play")
MenuItem(#cpause, "Pause")
MenuItem(#cstop, "Stop")
MenuTitle("Affichage")
OpenSubMenu("Zoom")
MenuItem(#zx1demi,"1/2x")
MenuItem(#zx1,"1x")
MenuItem(#zx2,"2x")
MenuItem(#zx3,"3x")
MenuTitle("Aide")
MenuItem(#aapropos, "A propos")
EndIf
play3 = ExtractSmallIconFile(Play2$)
pause3 = ExtractSmallIconFile(pause2$)
stop3 = ExtractSmallIconFile("stop.ico")
CreateGadgetList(WindowID())
CreateToolBarXP(WindowID(), 16, 0)
CatchImage(3, ?toolbarxp16)
SetToolBarXPShape(UseImage(3), RGB(237, 241, 252), GetSysColor_(#COLOR_3DFACE), 300) ; Commenter cette fonction pour voir la barre d'outils par défaut
SetToolBarXPTextColor(0, RGB(255, 0, 0))
ToolBarXPStart()
ToolBarXPButton(#play, Play2, "Play")
ToolBarXPButton(#pause, pause2, "Pause")
ToolBarXPButton(#stop, stop2, "Stop")
ToolBarXPEnd()
EndIf
If CreateStatusBar(#Statut, WindowID())
AddStatusBarField(200000)
EndIf
hSeek=TrackBarGadget(#progression,220,4,80,20,0,1000000)
EndProcedure
Procedure ReadyMovie()
azik$=zik$
zik$ = OpenFileRequester("Fichier à lire", "", "Fichiers Video|*.avi;*.divx;*.mkv;*.mov;*.mpeg;*.mpg;*.wmv|Tous|*.*",0)
If zik$ <> ""
If azik$ <> zik$
MCI_Free(0)
EndIf
MCI_Load(0,zik$)
TrackBarGadget(#volume,170,4, 50,20,0,1000)
SetGadgetState(#volume, 1000) :volume=1000
ResizeWindow(Val(MCI_GetWidth(0)),Val(MCI_GetHeight(0))+94)
StatusBarText(#Statut,0,"Durée: "+Str(MCI_GetLength(0))+"s " +Str(MCI_GetLength(0))+" Frames, " +zik$ ,0)
StatusBarText(#Statut,1,zik$,0)
MCI_Parent(0,WindowID())
width=Val(MCI_GetWidth(0))
MCI_Play(0)
MCI_ReSize(0,"0","25",Str(WindowWidth()),Str(WindowHeight()-94))
ResizeGadget(#progression,0,WindowHeight()-70,WindowWidth(),20)
;SendMessage_(hSeek, #TBM_SETRANGEMAX,#True,MCI_GetLength(0))
SendMessage_(hSeek, #TBM_SETRANGEMAX,#True,MCI_GetLength(0))
EndIf
EndProcedure
;-Debut
Open_player()
UseOGGSoundDecoder()
Repeat
progression = MCI_GetPosition(0)
SetWindowTitle(#pingtixplayer,"Pingtix Player" +Str(MCI_GetPosition(0))+" "+Str(MCI_GetLength(0)))
SetGadgetState(#progression,MCI_GetPosition(0))
Select WindowEvent()
Case 0
Delay(20)
Case #PB_Event_Gadget
Select EventGadgetID()
Case #play
MCI_Play(0)
Case #pause
MCI_Pause(0)
Case #stop
MCI_Stop(0)
Case #volume
volume = GetGadgetState(#volume)
MCI_SetVolume(0,volume)
Case #progression
np=GetGadgetState(#progression)
MCI_Seek(0,np)
EndSelect
Case #PB_Event_Menu
Select EventMenuID()
Case #fouvrir
ReadyMovie()
Case #fquitter
End
Case #cplay
MCI_Play(0)
Case #cpause
MCI_Pause(0)
Case #cstop
MCI_Stop(0)
Case #aapropos
MessageRequester("A propos", "Pingtix Player" + Chr(10)+"Programmé par Pingtix" + Chr(10)+"© Rileck Corp" , #MB_OK|#MB_ICONINFORMATION)
Case #zx1demi
Case #zx1
Case #zx2
Case #zx3
EndSelect
Case #PB_Event_SizeWindow
resize()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
End
DataSection ;{
Play2: IncludeBinary "play.ico"
pause2: IncludeBinary "pause.ico"
stop2: IncludeBinary "stop.ico"
toolbarxp16: IncludeBinary "ToolBarXP 16.bmp"
EndDataSection ;}