Code : Tout sélectionner
Resultat = InitMovie()
Declare WindowCallback(WindowID,message,wParam,lParam)
Declare Open_Window_0()
Global bitmap
Global Form1
UseJPEGImageDecoder()
UsePNGImageDecoder()
UseTIFFImageDecoder()
UseTGAImageDecoder()
Enumeration
#Window_0
EndEnumeration
Enumeration
#liste
#play
#StopMovie
#Image
#PauseMovie
EndEnumeration
NomFichier$ = OpenFileRequester("Choisir une image", "c:\", "Images|*.bmp", 0)
bitmap = LoadImage(0, NomFichier$)
Open_Window_0()
Repeat
Event = WaitWindowEvent()
If Event = #PB_EventGadget
GadgetID = EventGadgetID()
If GadgetID = #liste
NomFichier$ = OpenFileRequester("Titre", "::{450d8fba-ad25-11d0-98a8-0800361b1103}\" , "Fichiers|*.*", 0)
LoadMovie(1, NomFichier$)
ElseIf GadgetID = #play
PlayMovie(1, FenetreID)
ElseIf GadgetID = #StopMovie
StopMovie()
ElseIf GadgetID = #Image
ElseIf GadgetID = #PauseMovie
If GetGadgetState(#PauseMovie) = 1
PauseMovie()
Else
ResumeMovie()
EndIf
EndIf
EndIf
Until Event = #PB_EventCloseWindow
End
Procedure Open_Window_0()
Form1=OpenWindow(0,0,0,700,400,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered,"audio player 1.0")
If Form1
If CreateGadgetList(Form1)
ButtonGadget(#liste, 2, 1, 138, 30, "LISTE ~~")
ButtonGadget(#play, 140, 1, 140, 30, "LECTURE >")
ButtonGadget(#PauseMovie, 280, 1, 140, 30, "PAUSE II", #PB_Button_Toggle )
ButtonGadget(#StopMovie, 420, 1, 140, 30,"STOP #")
ButtonGadget(#Image, 560, 1, 140, 30, "VISUALISATION"): DisableGadget(3,1)
EndIf
SetWindowCallback(@WindowCallback())
EndIf
EndProcedure
Procedure WindowCallback(WindowID,message,wParam,lParam)
res=#PB_ProcessPureBasicEvents
Select message
Case #WM_PAINT
ps.PAINTSTRUCT
hdc=BeginPaint_(Form1,ps)
hdcMem=CreateCompatibleDC_(hdc)
SelectObject_(hdcMem,bitmap)
BitBlt_(hdc,1,1,699,399,hdcMem,0,0,#SRCCOPY) ; mettre le meme format que la fenetre !!!(700-1*400-1)
ReleaseDC_(WindowID(0),hdc)
DeleteDC_(hdcMem)
DeleteObject_(hdcMem)
EndPaint_(Form1,ps)
ProcedureReturn #True
Case #WM_COMMAND
If lParam=GadgetID(0)
NomFichier$ = OpenFileRequester("Choisir une image", "c:\", "Images|*.bmp", 0)
Image = LoadImage(0, NomFichier$)
EndIf
EndSelect
ProcedureReturn res
EndProcedure