Bon j'ai un autre petit probleme, lorsque j'affiche un "toast", la fenetre apparait bien mais pas les gadgets
. Enfin regardez par vous même :
Code : Tout sélectionner
Procedure Toast_MoveWindow(Window, x, y, yFinal)
Width = WindowWidth(Window)
Height = WindowHeight(Window)
If yFinal > y
For i=y To yFinal Step 1
ResizeWindow(Window, x, i, Width, Height)
Delay(30)
Next
Else
For i=y To yFinal Step -1
ResizeWindow(Window, x, i, Width, Height)
Delay(30)
Next
EndIf
EndProcedure
Procedure Toast_RemoveFromTaskBar(window.l, state.l)
Protected hwnd.l = WindowID(window)
; cache la fenêtre
ShowWindow_(hwnd, #SW_HIDE)
; change le style de la fenêtre ( le plus important )
If state
SetWindowLong_(hwnd, #GWL_EXSTYLE, GetWindowLong_(hwnd, #GWL_EXSTYLE) | #WS_EX_TOOLWINDOW)
Else
SetWindowLong_(hwnd, #GWL_EXSTYLE, GetWindowLong_(hwnd, #GWL_EXSTYLE) & (~#WS_EX_TOOLWINDOW))
EndIf
; notifie la fenêtre que son apparence a changé (mais ni sa taille, ni sa position)
If SetWindowPos_(hwnd, 0, 0, 0, 0, 0, #SWP_NOSIZE|#SWP_NOMOVE|#SWP_SHOWWINDOW| #SWP_FRAMECHANGED)
ProcedureReturn #True
EndIf
EndProcedure
Procedure OpenToast(Window, TitleGadget, MessageGadget, Title.s, Message.s, TitleColor, MessageColor, BackgroundColor, Time)
;on commence par récupérer les informations sur l'ecran
ExamineDesktops()
ScreenWidth = DesktopWidth(0)
ScreenHeight = DesktopHeight(0)
;taille du toast
WindowWidth = 200
WindowHeight = 100
;on calcule les coordonnées du toast
x = ScreenWidth - WindowWidth
;on calcule les coordonnées du mouvement du toast
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @ScreenSize.RECT, 0) ;on recupère les informations sur la taille de l'ecran
StartY = ScreenSize\Bottom ;on commencera à afficher le toast juste au desus de la barre des taches
EndY = StartY - WindowHeight
;puis on ouvre la fenetre sans bordure
If OpenWindow(Window, x, StartY, WindowWidth, WindowHeight, Title, #PB_Window_BorderLess)
Toast_RemoveFromTaskBar(Window, 1)
SetWindowColor(Window, BackgroundColor)
If CreateGadgetList(WindowID(Window))
;on affiche le titre et on change sa couleur selon les préférences
TextGadget(TitleGadget, 3, 3, 194, 15, Title)
SetGadgetColor(TitleGadget, #PB_Gadget_BackColor, BackgroundColor)
SetGadgetColor(TitleGadget, #PB_Gadget_FrontColor, TitleColor)
;on affiche le message et on change sa couleur selon les préféreces
TextGadget(MessageGadget, 3, 20, 194, 77, Message)
SetGadgetColor(MessageGadget, #PB_Gadget_BackColor, BackgroundColor)
SetGadgetColor(MessageGadget, #PB_Gadget_FrontColor, MessageColor)
Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow Or 1
Toast_MoveWindow(Window, x, StartY, EndY)
Delay(Time)
Toast_MoveWindow(Window, x, EndY, StartY)
CloseWindow(Window)
EndIf
EndIf
EndProcedure
OpenToast(1, 50, 12, "Test", "Blabla", RGB(255, 128, 0), RGB(255, 0, 0), RGB(255, 255, 255), 3000)