Code : Tout sélectionner
;- Window Constants
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
Enumeration
#Panel_0
#Button_1
#String_1
#Button_2
#String_2
#Button_3
#String_3
#Button_4
#String_4
#Button_5
#String_5
#Button_6
#String_6
#Button_7
#String_7
#Button_8
#String_8
#Button_9
#String_9
#Button_10
#String_10
#Button_11
#String_11
#Button_12
#String_12
#Button_13
#String_13
#Button_14
#String_14
#Button_15
#String_15
#Button_16
#String_16
#Button_17
#String_17
#Button_18
#String_18
EndEnumeration
chemain$ = Left(GetHomeDirectory(), 3)
If OpenWindow(#Window_0, 0, 0, 510, 115, "Ibarre | option", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
If CreateGadgetList(WindowID(#Window_0))
OpenPreferences(chemain$+"WINDOWS\Ibarre.ini")
;- Panel0
PanelGadget(#Panel_0, 10, 5, 490, 100)
AddGadgetItem(#Panel_0, 1, "bouton 1")
ButtonGadget(#Button_1, 13, 13, 100, 20, "choisir une image")
String_1$ = ReadPreferenceString("1", "")
StringGadget(#String_1, 123, 13, 350, 20, String_1$, #PB_String_ReadOnly)
ButtonGadget(#Button_2, 13, 43, 100, 20, "choisir un logiciel")
String_2$ = ReadPreferenceString("2", String_2$)
StringGadget(#String_2, 123, 43, 350, 20, "", #PB_String_ReadOnly)
AddGadgetItem(#Panel_0, 2, "bouton 2")
ButtonGadget(#Button_3, 13, 13, 100, 20, "choisir une image")
String_3$ = ReadPreferenceString("3", "")
StringGadget(#String_3, 123, 13, 350, 20, String_3$, #PB_String_ReadOnly)
ButtonGadget(#Button_4, 13, 43, 100, 20, "choisir un logiciel")
String_4$ = ReadPreferenceString("4", "")
StringGadget(#String_4, 123, 43, 350, 20, String_4$, #PB_String_ReadOnly)
AddGadgetItem(#Panel_0, 3, "bouton 3")
ButtonGadget(#Button_5, 13, 13, 100, 20, "choisir une image")
String_5$ = ReadPreferenceString("5", "")
StringGadget(#String_5, 123, 13, 350, 20, String_5$, #PB_String_ReadOnly)
ButtonGadget(#Button_6, 13, 43, 100, 20, "choisir un logiciel")
String_6$ = ReadPreferenceString("6", "")
StringGadget(#String_6, 123, 43, 350, 20, String_6$, #PB_String_ReadOnly)
AddGadgetItem(#Panel_0, 4, "bouton 4")
ButtonGadget(#Button_7, 13, 13, 100, 20, "choisir une image")
String_7$ = ReadPreferenceString("7", "")
StringGadget(#String_7, 123, 13, 350, 20, String_7$, #PB_String_ReadOnly)
ButtonGadget(#Button_8, 13, 43, 100, 20, "choisir un logiciel")
String_8$ = ReadPreferenceString("8", "")
StringGadget(#String_8, 123, 43, 350, 20, String_8$, #PB_String_ReadOnly)
AddGadgetItem(#Panel_0, 5, "bouton 5")
ButtonGadget(#Button_9, 13, 13, 100, 20, "choisir une image")
String_9$ = ReadPreferenceString("9", "")
StringGadget(#String_9, 123, 13, 350, 20, String_9$, #PB_String_ReadOnly)
ButtonGadget(#Button_10, 13, 43, 100, 20, "choisir un logiciel")
String_10$ = ReadPreferenceString("10", "")
StringGadget(#String_10, 123, 43, 350, 20, String_10$, #PB_String_ReadOnly)
AddGadgetItem(#Panel_0, 6, "bouton 6")
ButtonGadget(#Button_11, 13, 13, 100, 20, "choisir une image")
String_11$ = ReadPreferenceString("11", "")
StringGadget(#String_11, 123, 13, 350, 20, String_11$, #PB_String_ReadOnly)
ButtonGadget(#Button_12, 13, 43, 100, 20, "choisir un logiciel")
String_12$ = ReadPreferenceString("12", "")
StringGadget(#String_12, 123, 43, 350, 20, String_12$, #PB_String_ReadOnly)
AddGadgetItem(#Panel_0, 7, "bouton 7")
ButtonGadget(#Button_13, 13, 13, 100, 20, "choisir une image")
String_13$ = ReadPreferenceString("13", "")
StringGadget(#String_13, 123, 13, 350, 20, String_13$, #PB_String_ReadOnly)
ButtonGadget(#Button_14, 13, 43, 100, 20, "choisir un logiciel")
String_14$ = ReadPreferenceString("14", "")
StringGadget(#String_14, 123, 43, 350, 20, String_14$, #PB_String_ReadOnly)
AddGadgetItem(#Panel_0, 8, "bouton 8")
ButtonGadget(#Button_15, 13, 13, 100, 20, "choisir une image")
String_15$ = ReadPreferenceString("15", "")
StringGadget(#String_15, 123, 13, 350, 20, String_15$, #PB_String_ReadOnly)
ButtonGadget(#Button_16, 13, 43, 100, 20, "choisir un logiciel")
String_16$ = ReadPreferenceString("16", "")
StringGadget(#String_16, 123, 43, 350, 20, String_16$, #PB_String_ReadOnly)
AddGadgetItem(#Panel_0, 9, "bouton 9")
ButtonGadget(#Button_17, 13, 13, 100, 20, "choisir une image")
String_17$ = ReadPreferenceString("17", "")
StringGadget(#String_17, 123, 13, 350, 20, String_17$, #PB_String_ReadOnly)
ButtonGadget(#Button_18, 13, 43, 100, 20, "choisir un logiciel")
String_18$ = ReadPreferenceString("18", "")
StringGadget(#String_18, 123, 43, 350, 20, String_18$, #PB_String_ReadOnly)
CloseGadgetList()
EndIf
EndIf
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_Gadget
Select EventGadget()
Case #Button_1
String_1$ = OpenFileRequester("ouvrir une image", "", "image|*.bmp;*.jpg;*.png" , 0)
SetGadgetText(#String_1, String_1$)
Case #Button_2
String_2$ = OpenFileRequester("choisir un fichier", "", "fichier|*.*" , 0)
SetGadgetText(#String_2, String_2$)
Case #Button_3
String_3$ = OpenFileRequester("ouvrir une image", "", "image|*.bmp;*.jpg;*.png" , 0)
SetGadgetText(#String_3, String_3$)
Case #Button_4
String_4$ = OpenFileRequester("choisir un fichier", "", "fichier|*.*" , 0)
SetGadgetText(#String_4, String_4$)
Case #Button_5
String_5$ = OpenFileRequester("ouvrir une image", "", "image|*.bmp;*.jpg;*.png" , 0)
SetGadgetText(#String_5, String_5$)
Case #Button_6
String_6$ = OpenFileRequester("choisir un fichier", "", "fichier|*.*" , 0)
SetGadgetText(#String_6, String_6$)
Case #Button_7
String_7$ = OpenFileRequester("ouvrir une image", "", "image|*.bmp;*.jpg;*.png" , 0)
SetGadgetText(#String_7, String_7$)
Case #Button_8
String_8$ = OpenFileRequester("choisir un fichier", "", "fichier|*.*" , 0)
SetGadgetText(#String_8, String_8$)
Case #Button_9
String_9$ = OpenFileRequester("ouvrir une image", "", "image|*.bmp;*.jpg;*.png" , 0)
SetGadgetText(#String_9, String_9$)
Case #Button_10
String_10$ = OpenFileRequester("choisir un fichier", "", "fichier|*.*" , 0)
SetGadgetText(#String_10, String_10$)
Case #Button_11
String_11$ = OpenFileRequester("ouvrir une image", "", "image|*.bmp;*.jpg;*.png" , 0)
SetGadgetText(#String_11, String_11$)
Case #Button_12
String_12$ = OpenFileRequester("choisir un fichier", "", "fichier|*.*" , 0)
SetGadgetText(#String_12, String_12$)
Case #Button_13
String_13$ = OpenFileRequester("ouvrir une image", "", "image|*.bmp;*.jpg;*.png" , 0)
SetGadgetText(#String_13, String_13$)
Case #Button_14
String_14$ = OpenFileRequester("choisir un fichier", "", "fichier|*.*" , 0)
SetGadgetText(#String_14, String_14$)
Case #Button_15
String_15$ = OpenFileRequester("ouvrir une image", "", "image|*.bmp;*.jpg;*.png" , 0)
SetGadgetText(#String_15, String_15$)
Case #Button_16
String_16$ = OpenFileRequester("choisir un fichier", "", "fichier|*.*" , 0)
SetGadgetText(#String_16, String_16$)
Case #Button_17
String_17$ = OpenFileRequester("ouvrir une image", "", "image|*.bmp;*.jpg;*.png" , 0)
SetGadgetText(#String_17, String_17$)
Case #Button_18
String_18$ = OpenFileRequester("choisir un fichier", "", "fichier|*.*" , 0)
SetGadgetText(#String_18, String_18$)
EndSelect
EndIf
Until EventID = #PB_Event_CloseWindow
CreatePreferences(chemain$+"WINDOWS\Ibarre.ini")
WritePreferenceString("1", String_1$)
WritePreferenceString("2", String_2$)
WritePreferenceString("3", String_3$)
WritePreferenceString("4", String_4$)
WritePreferenceString("5", String_5$)
WritePreferenceString("6", String_6$)
WritePreferenceString("7", String_7$)
WritePreferenceString("8", String_8$)
WritePreferenceString("9", String_9$)
WritePreferenceString("10", String_10$)
WritePreferenceString("11", String_11$)
WritePreferenceString("12", String_12$)
WritePreferenceString("13", String_13$)
WritePreferenceString("14", String_14$)
WritePreferenceString("15", String_15$)
WritePreferenceString("16", String_16$)
WritePreferenceString("17", String_17$)
WritePreferenceString("18", String_18$)
ClosePreferences()
ClosePreferences()
Code : Tout sélectionner
;- Window Constants
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
Enumeration
#stop
#Image_barre
#Image_fermer
#Image_0
#Image_1
#Image_2
#Image_3
#Image_4
#Image_5
#Image_6
#Image_7
#Image_8
#TrackBar_0
EndEnumeration
UseJPEGImageDecoder()
UsePNGImageDecoder()
chemain$ = Left(GetHomeDirectory(), 3)
OpenPreferences(chemain$+"WINDOWS\Ibarre1.ini")
posx$ = ReadPreferenceString("x", "")
posy$ = ReadPreferenceString("y", "")
Procedure SetWinTransparency (WinHandle.l, Transparency_Level.l)
SetWindowLong_(WinHandle, #GWL_EXSTYLE, $00080000) ; #WS_EX_LAYERED = $00080000
SetLayeredWindowAttributes_(WinHandle, 0, Transparency_Level, 2) ;
EndProcedure
If OpenWindow(#Window_0, Val(posx$), Val(posy$), 595, 85, "Ibarre", #PB_Window_BorderLess)
StickyWindow(#Window_0, 1)
SetWindowColor(#Window_0, RGB(0, 0,200))
trans$ = ReadPreferenceString("1_1", "")
SetWinTransparency(WindowID(#Window_0), Val(trans$))
AddKeyboardShortcut(#Window_0,#PB_Shortcut_Escape, #stop)
If CreateGadgetList(WindowID(#Window_0))
If LoadImage(#Image_barre, "c:/barre.bmp")
ImageGadget(#Image_barre, 0, 0, 585, 10, ImageID(#Image_barre))
EndIf
If LoadImage(#Image_fermer, "c:/fermer.bmp")
ImageGadget(#Image_fermer, 585, 0, 10, 10, ImageID(#Image_fermer))
EndIf
ProgressBarGadget(#TrackBar_0, 0, 10, 595, 10, 0, 255, #PB_ProgressBar_Smooth)
SetGadgetState(#TrackBar_0, Val(trans$))
SetGadgetColor(#TrackBar_0, #PB_Gadget_BackColor, RGB(0,0,200))
SetGadgetColor(#TrackBar_0, #PB_Gadget_FrontColor, RGB(0,255,0))
ClosePreferences()
OpenPreferences(chemain$+"WINDOWS\Ibarre.ini")
Image_1$ = ReadPreferenceString("1", "")
Image_1_1$ = ReadPreferenceString("2", "")
If LoadImage(#Image_0, Image_1$)
ResizeImage(#Image_0, 64, 64, #PB_Image_Smooth)
ImageGadget(#Image_0, 5, 20, 64, 64, ImageID(#Image_0))
GadgetToolTip(#Image_0, GetFilePart(Image_1_1$))
EndIf
Image_2$ = ReadPreferenceString("3", "")
Image_2_2$ = ReadPreferenceString("4", "")
If LoadImage(#Image_1, Image_2$)
ResizeImage(#Image_1, 64, 64, #PB_Image_Smooth)
ImageGadget(#Image_1, 70, 20, 64, 64, ImageID(#Image_1))
GadgetToolTip(#Image_1, GetFilePart(Image_2_2$))
EndIf
Image_3$ = ReadPreferenceString("5", "")
Image_3_3$ = ReadPreferenceString("6", "")
If LoadImage(#Image_2, Image_3$)
ResizeImage(#Image_2, 64, 64, #PB_Image_Smooth)
ImageGadget(#Image_2, 135, 20, 64, 64, ImageID(#Image_2))
GadgetToolTip(#Image_2, GetFilePart(Image_3_3$))
EndIf
Image_4$ = ReadPreferenceString("7", "")
Image_4_4$ = ReadPreferenceString("8", "")
If LoadImage(#Image_3, Image_4$)
ResizeImage(#Image_3, 64, 64, #PB_Image_Smooth)
ImageGadget(#Image_3, 200, 20, 64, 64, ImageID(#Image_3))
GadgetToolTip(#Image_3, GetFilePart(Image_4_4$))
EndIf
Image_5$ = ReadPreferenceString("9", "")
Image_5_5$ = ReadPreferenceString("10", "")
If LoadImage(#Image_4, Image_5$)
ResizeImage(#Image_4, 64, 64, #PB_Image_Smooth)
ImageGadget(#Image_4, 265, 20, 64, 64, ImageID(#Image_4))
GadgetToolTip(#Image_4, GetFilePart(Image_5_5$))
EndIf
Image_6$ = ReadPreferenceString("11", "")
Image_6_6$ = ReadPreferenceString("12", "")
If LoadImage(#Image_5, Image_6$)
ResizeImage(#Image_5, 64, 64, #PB_Image_Smooth)
ImageGadget(#Image_5, 330, 20, 64, 64, ImageID(#Image_5))
GadgetToolTip(#Image_5, GetFilePart(Image_6_6$))
EndIf
Image_7$ = ReadPreferenceString("13", "")
Image_7_7$ = ReadPreferenceString("14", "")
If LoadImage(#Image_6, Image_7$)
ResizeImage(#Image_6, 64, 64, #PB_Image_Smooth)
ImageGadget(#Image_6, 395, 20, 64, 64, ImageID(#Image_6))
GadgetToolTip(#Image_6, GetFilePart(Image_7_7$))
EndIf
Image_8$ = ReadPreferenceString("15", "")
Image_8_8$ = ReadPreferenceString("16", "")
If LoadImage(#Image_7, Image_8$)
ResizeImage(#Image_7, 64, 64, #PB_Image_Smooth)
ImageGadget(#Image_7, 460, 20, 64, 64, ImageID(#Image_7))
GadgetToolTip(#Image_7, GetFilePart(Image_8_8$))
EndIf
Image_9$ = ReadPreferenceString("17", "")
Image_9_9$ = ReadPreferenceString("18", "")
If LoadImage(#Image_8, Image_9$)
ResizeImage(#Image_8, 64, 64, #PB_Image_Smooth)
ImageGadget(#Image_8, 525, 20, 64, 64, ImageID(#Image_8))
GadgetToolTip(#Image_8, GetFilePart(Image_9_9$))
EndIf
EndIf
EndIf
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #WM_LBUTTONDOWN
Select WindowFromPoint_(DesktopMouseX(), DesktopMouseY()) ; On regarde le gadget qui est sous la souris
Case GadgetID(#TrackBar_0)
distance = 255 * (WindowMouseX(#Window_0) - GadgetX(#TrackBar_0)) / GadgetWidth(#TrackBar_0) ; On calcul la position de la Pogressbar
SetGadgetState(#TrackBar_0, distance)
SetWinTransparency(WindowID(#Window_0), distance)
ProgressBar = #True
EndSelect
EndSelect
If EventID = #PB_Event_Gadget
Select EventGadget()
Case #Image_barre
SendMessage_(WindowID(#Window_0), #WM_NCLBUTTONDOWN, #HTCAPTION ,0)
Case #Image_fermer
x = WindowX(#Window_0)
y = WindowY(#Window_0)
CreatePreferences(chemain$+"WINDOWS\Ibarre1.ini")
WritePreferenceString("1_1", Str(GetGadgetState(#TrackBar_0)))
WritePreferenceString("x", Str(x))
WritePreferenceString("y", Str(y))
ClosePreferences()
End
Case #Image_0
Executable_0$ = ReadPreferenceString("2", "")
RunProgram(Executable_0$, "","", 0, 0)
Case #Image_1
Executable_1$ = ReadPreferenceString("4", "")
RunProgram(Executable_1$, "","", 0, 0)
Case #Image_2
Executable_2$ = ReadPreferenceString("6", "")
RunProgram(Executable_2$, "","", 0, 0)
Case #Image_3
Executable_3$ = ReadPreferenceString("8", "")
RunProgram(Executable_3$, "","", 0, 0)
Case #Image_4
Executable_4$ = ReadPreferenceString("10", "")
RunProgram(Executable_4$, "","", 0, 0)
Case #Image_5
Executable_5$ = ReadPreferenceString("12", "")
RunProgram(Executable_5$, "","", 0, 0)
Case #Image_6
Executable_6$ = ReadPreferenceString("14", "")
RunProgram(Executable_6$, "","", 0, 0)
Case #Image_7
Executable_7$ = ReadPreferenceString("16", "")
RunProgram(Executable_7$, "","", 0, 0)
Case #Image_8
Executable_8$ = ReadPreferenceString("18", "")
RunProgram(Executable_8$, "","", 0, 0)
EndSelect
EndIf
Until EventID = #PB_Event_CloseWindow