Ouvrir une fentre "toast" comme msn
-
- Messages : 510
- Inscription : dim. 25/mars/2007 13:44
- Localisation : Toulouse, France
- Contact :
Ouvrir une fentre "toast" comme msn
bonjour je voudrais créer un petite alerte qui s'affiche en bas à droite de l'ecran comme lorsqu'un contact se connecte sur msn. Le problème c'est que je ne sait pas du tout comment m'y prendre, il faut utiliser les sprites ?
Re: Ouvrir une fentre "toast" comme msn
....
Dernière modification par Backup le mar. 19/août/2014 12:47, modifié 2 fois.
Salut lepiaf,
la fonction recherche de phpbb est bien merdique mais donne parfois quelques résultats probants.
Ce que tu cherches est expliqué ici :
http://www.purebasic.fr/french/viewtopi ... rre+taches
la fonction recherche de phpbb est bien merdique mais donne parfois quelques résultats probants.
Ce que tu cherches est expliqué ici :
http://www.purebasic.fr/french/viewtopi ... rre+taches
-
- Messages : 510
- Inscription : dim. 25/mars/2007 13:44
- Localisation : Toulouse, France
- Contact :
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 :
[/quote]

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)