Un petit prog pour visualiser ses photos JPG que j'ai fait hier soir (versio bêta voire alpha):
Pour la versio complète, vous pouvez le télécharger ici (l'installeur permet d'associer les JPG avec automatiquement et d'avoir l'icône en plus, sinon, il faut rajouter l'argument d'une photo JPG à la compilation, quand vous copiez le code source dans l'IDE) : http://jntradio.free.fr/setup_IFirispictureWin32.exe
Code : Tout sélectionner
Declare.s GetPhoto(command.s)
Declare LoadIt(path.s, hasToClose)
ExamineDesktops()
Global xSize = DesktopWidth(0)
Global ySize = DesktopHeight(0)
UseJPEGImageDecoder()
OpenWindow(1, 0, 0, 0, 0, "IrisPicture", #PB_Window_BorderLess|#PB_Window_ScreenCentered)
TextGadget(5, 0, Int((ySize - 15) / 2), xSize, 15, "Chargement...", #PB_Text_Center)
SetGadgetColor(5, #PB_Gadget_BackColor, 0)
SetGadgetColor(5, #PB_Gadget_FrontColor, $FFFFFF)
SetWindowColor(1, 0)
Style = GetWindowLong_(WindowID(1), #GWL_EXSTYLE)
SetWindowLong_(WindowID(1), #GWL_EXSTYLE, Style|#WS_EX_LAYERED|#WS_EX_TOOLWINDOW)
SetLayeredWindowAttributes_(WindowID(1), 0, 200, #LWA_ALPHA)
ResizeWindow(1, 0, 0, xSize, ySize)
command.s = PeekS(GetCommandLine_(), -1, #PB_Unicode)
path.s = GetPhoto(command)
ExamineDirectory(0, GetPathPart(path), "*.jpg")
Dim listOfJPG.s(1)
nbFile = 1
While NextDirectoryEntry(0)
If DirectoryEntryType(0) = #PB_DirectoryEntry_File
nbFile = nbFile + 1
ReDim listOfJPG(nbFile)
listOfJPG(nbFile) = DirectoryEntryName(0)
If Left(GetFilePart(path), 6) = Left(DirectoryEntryName(0), 6) And FileSize(path) = DirectoryEntrySize(0) And GetFileAttributes(path) = DirectoryEntryAttributes(0) And GetFileDate(path, #PB_Date_Created) = DirectoryEntryDate(0, #PB_Date_Created) And GetFileDate(path, #PB_Date_Modified) = DirectoryEntryDate(0, #PB_Date_Modified) And GetFileDate(path, #PB_Date_Accessed) = DirectoryEntryDate(0, #PB_Date_Accessed)
posBase = nbFile
EndIf
EndIf
Wend
LoadIt(path, 0)
Repeat
Delay(1)
If GetForegroundWindow_() = WindowID(1) Or GetForegroundWindow_() = WindowID(0)
If GetAsyncKeyState_(1) Or GetAsyncKeyState_(#VK_ESCAPE) Or GetAsyncKeyState_(#VK_RETURN)
Break
EndIf
If GetAsyncKeyState_(#VK_LEFT)
posBase = posBase - 1
If posBase = -1
posBase = nbFile
EndIf
While LCase(Right(listOfJPG(posBase), 4)) <> ".jpg"
posBase = posBase - 1
If posBase = -1
posBase = nbFile
EndIf
Wend
LoadIt(GetPathPart(path) + listOfJPG(posBase), 1)
EndIf
If GetAsyncKeyState_(#VK_RIGHT)
posBase = posBase + 1
If posBase = nbFile + 1
posBase = 1
EndIf
While LCase(Right(listOfJPG(posBase), 4)) <> ".jpg"
posBase = posBase + 1
If posBase = nbFile + 1
posBase = 1
EndIf
Wend
LoadIt(GetPathPart(path) + listOfJPG(posBase), 1)
EndIf
EndIf
Until WindowEvent() = #PB_Event_CloseWindow
End
Procedure.s GetPhoto(command.s)
command = Trim(command)
pos = 1
While Left(Right(command, pos), 1) <> ":"
pos = pos + 1
Wend
pos = pos + 1
If Right(command, 1) = Chr(34)
command = Left(command, Len(command) - 1)
EndIf
ProcedureReturn Right(command, pos)
EndProcedure
Procedure LoadIt(path.s, hasToClose)
If hasToClose : CloseWindow(0) : EndIf
SetGadgetText(5, "Chargement de " + GetFilePart(path) + " ...")
LoadImage(1, path, #PB_Image_DisplayFormat)
If ImageWidth(1) > xSize - 50
ResizeImage(1, xSize - 50, ImageHeight(1) * (xSize - 50) / ImageWidth(1))
EndIf
If ImageHeight(1) > ySize - 50
ResizeImage(1, ImageWidth(1) * (ySize - 50) / ImageHeight(1), ySize - 50)
EndIf
OpenWindow(0, 0, 0, ImageWidth(1), ImageHeight(1), "IrisPicture", #PB_Window_BorderLess|#PB_Window_ScreenCentered)
StickyWindow(0, 1)
StartDrawing(WindowOutput(0))
DrawImage(ImageID(1), 0, 0)
StopDrawing()
SetGadgetText(5, "")
EndProcedure
Si vous remarquez le moindre bug (fort probable ^^), dites-le moi !