Code : Tout sélectionner
Func message($titre,$texte,$Icon = 0 , $timeout = 3 ,$colortitre = 0x000080)
If Not $view_msg Then Return
Global $Form1 = GUICreate("", 327, 145,@DesktopWidth - 360, @DesktopHeight - 180,$WS_POPUP,$WS_EX_TOPMOST)
GUISetBkColor(0xFFFF80)
Global $Button1 = GUICtrlCreateButton("X", 290, 6, 22, 22)
GUICtrlSetFont(-1, 12, 800, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0xFF0000)
If StringLen($titre) < 25 Then
$tailleLab = 260
Else
$tailleLab = StringLen($titre) * 8
EndIf
If $Icon Then
Local $ch = GUICreate("", 228, 41, 44, 0, $WS_CHILD, -1, $Form1)
GUISetBkColor(0xFFFF80)
Else
Local $ch = GUICreate("", 260, 41, 24, 0, $WS_CHILD, -1, $Form1)
GUISetBkColor(0xFFFF80)
EndIf
$Label1 = GUICtrlCreateLabel($titre, 0, 0, $tailleLab, 41, $SS_CENTERIMAGE)
Select
Case StringLen($titre) <= 12
GUICtrlSetFont(-1, 26, 450, 0, "Arial")
Case StringLen($titre) < 16
GUICtrlSetFont(-1, 20, 450, 0, "Arial")
Case StringLen($titre) < 25
GUICtrlSetFont(-1, 14, 450, 0, "Arial")
Case Else
GUICtrlSetFont(-1, 10, 500, 0, "Arial")
$px = 0
AdLibRegister("slide", 80)
EndSelect
GUICtrlSetColor(-1, $colortitre)
GUICtrlSetBkColor($Label1,0xFFFF80)
GUISwitch($Form1)
Local $Label2 = GUICtrlCreateLabel($texte, 8, 45, 311, 100)
Switch $Icon
Case 1
Local $Icon1 = GUICtrlCreateIcon("C:\Windows\System32\user32.dll", -4, 2, 5, 32, 32)
Case 2
Local $Icon1 = GUICtrlCreateIcon("C:\Windows\System32\user32.dll", -3, 2, 5, 32, 32)
Case 3
Global $Icon1 = GUICtrlCreateIcon("C:\Windows\System32\user32.dll", -2, 2, 5, 32, 32)
Case 4
Global $Icon1 = GUICtrlCreateIcon("C:\Windows\System32\user32.dll", -5, 2, 5, 32, 32)
EndSwitch
GUISetState(@SW_SHOW,$Form1)
GUISetState(@SW_SHOW, $ch)
If $timeout Then $init = TimerInit()
Do
If GUIGetMsg() = $Button1 Then ExitLoop
If $timeout And TimerDiff($init) >= 999 * $timeout Then ExitLoop
Until 0
AdlibUnRegister("slide")
GUIDelete($Form1)
Return
EndFunc
Func slide()
$px -= 3
ConsoleWrite(GUICtrlSetPos($Label1, $px))
If $px < 270 - $tailleLab Then $px = 135
EndFunc