============================================
Ce script envoyant des requêtes répétées au site autoitscript.fr, entre des mains inconséquentes il peut surcharger la bande passante du forum, ce qui commençait d'ailleurs à se produire, comme me l'a signalé Tlem :
" Comme vous pouvez le constater dans la pièce jointe, votre script génère un trafic intense bien que vous ne soyez que quelques un à utiliser le script.
Le trafic est deux fois plus élevé que la consultation du forum par la totalité de ces membres et 3 fois plus importante que Google lui même.
Je comprend bien que le but est d'aider la communauté, mais si le nombre d'utilisateurs du script augmente, le forum risque fort de devenir indisponible à cause d'un trafic trop élevé. "
Donc à cause de mesures de restriction prises par l'admin, la dernière version postée ne fonctionne plus. Je l'ai quand même laissée pour certaines informations de code intéressantes qu'on peut en tirer, mais suite à la demande de Tlem, je ne poste pas la mise à jour du script fonctionnel
============================================
Version 5.32
Ajout : check s'il y a des nouveaux messages privés au lancement du script
Remplace la version 5.31 (pas mal buggée)
Version 5.3
Ajout : consultation des news (par notifications)
Gestion d'erreurs renforcée pour les connexions caractérielles
Version 5.22
Ajout : liste d'exceptions pour des noms d'utilisateurs dont on souhaite ignorer la réponse (pas de notification)
Merci à matwachich pour son beta-test haut de gamme

Version 5.21
Notifications : plus précises (notamment si surveillance de tous les forums), ajout du nom de l'auteur de la réponse
Attention, si une notif s'affiche en double, ce n'est pas un bug, c'est que la dernière réponse a été éditée par son auteur
Version 5.2
Correction du (dernier ?) bug (sur les liens si plusieurs notifications)
Ajout : surveillance de tous les forums
Version 5.1
Fignolage des fonctionnalités, optimisation du script
Ajout : gestion par icone dans le systray (double-clic pour l'affichage de la fenêtre, clic-droit pour le menu)
Version 5
Nouvelle gui pour simplifier (?) le code
Gestion et sauvegarde de la liste par fichier ini
Ajout : possibilité de la surveillance générale d'un forum
Alertes par notifications (d'après une idée de Melba23) au-dessus du systray
Version 4.1
Abandon de la surveillance du flux rss (bugs) remplacée par la surveillance directe des codes-source des pages
Abandon de InetRead qui renvoie trop de paquets corrompus remplacé par WinHttpRequest
► Afficher le texte
Code : Tout sélectionner
; Merci à Melba23 pour l'idée des notifications
#Include <Array.au3>
#include <ListviewConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 3)
$id = StringTrimRight(@ScriptName, 4)
If _Singleton($id , 1) = 0 Then
MsgBox(48, "Attention", " Ce programme est déjà lancé ")
Exit
EndIf
$ping = Ping("www.google.fr", 800)
If $ping = 0 Then
Msgbox(48,"Fatal Error", " Pas de connexion internet ")
Exit
EndIf
Global $radio[7], $btn[7], $index[7] = [3, 4, 6, 21, 20, 14, 9]
Global $urlforum = "http://www.autoitscript.fr/forum/viewforum.php?f="
Global $urltopic = "http://www.autoitscript.fr/forum/viewtopic.php?f="
Global $urlportal = "http://www.autoitscript.fr/forum/portal.php"
Global $ind, $string, $delai, $listGui, $gen_btn, $listview, $listguiexists = 0
Global $survArray[1][6], $survs = 0, $indexLV3, $notfound, $surv_gen = 0
Global $survList, $reset_btn, $ok_btn, $survMenuVire, $allforums = 0
Global $message[3], $loading = 0, $g_eventerror = 0, $infos, $started = 0, $test_act = 0
Global $iniGui, $edit, $ini = "C:\survforum.ini"
Global $Notification[1][3], $retracting = 0, $nb_notifs = 0
Global $Notif_W = 440, $Notif_H = 36
Global $Notif_X = @DesktopWidth - 10 - $Notif_W
Global $traytip = 1, $except = "", $noNotif = 0
Global $Notif_news[1][3], $news = 0, $nb_notifs_news = 0
Global $hNotif_mail, $checkmail, $mails = 0
Global $urlmail = "http://www.autoitscript.fr/forum/ucp.php?i=pm&folder=inbox"
Global $T_gui = TrayCreateItem ("Réduire la fenêtre")
Global $T_surv = TrayCreateItem ("Lancer la surveillance")
TrayCreateItem ("")
Global $T_news= TrayCreateItem ("News")
TrayCreateItem ("")
Global $T_ini = TrayCreateItem ("Voir le ini")
TrayCreateItem ("")
$T_exit = TrayCreateItem ("Quitter")
TraySetClick(8)
$mainGui = GUICreate("Surveillance arrêtée", 635, 186, 300, 20, _
BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX))
$group1 = GUICtrlCreateGroup("Forums", 10, 5, 214, 175)
$radio[0] = GUICtrlCreateRadio("Aide générale", 20, 22, 170, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
$radio[1] = GUICtrlCreateRadio("Interface utilisateur (GUI)", 20, 40, 170, 20)
$radio[2] = GUICtrlCreateRadio("Exemples de script", 20, 58, 170, 20)
$radio[3] = GUICtrlCreateRadio("Fonctions et UDF", 20, 76, 170, 20)
$radio[4] = GUICtrlCreateRadio("Demande de création de Scripts", 20, 94, 170, 20)
$radio[5] = GUICtrlCreateRadio("La vie du Forum", 20, 112, 170, 20)
$radio[6] = GUICtrlCreateRadio("Chat", 20, 130, 170, 20)
$btn[0] = GUICtrlCreateButton(".", 195, 24, 20, 15)
$btn[1] = GUICtrlCreateButton(".", 195, 42, 20, 15)
$btn[2] = GUICtrlCreateButton(".", 195, 60, 20, 15)
$btn[3] = GUICtrlCreateButton(".", 195, 78, 20, 15)
$btn[4] = GUICtrlCreateButton(".", 195, 96, 20, 15)
$btn[5] = GUICtrlCreateButton(".", 195, 114, 20, 15)
$btn[6] = GUICtrlCreateButton(".", 195, 132, 20, 15)
GUICtrlCreateLabel("Users à ignorer", 18, 158, 75, 16)
GUICtrlSetTip(-1, "noms à ignorer, séparés par des virgules")
$e_input = GUICtrlCreateInput("", 95, 155, 120, 18)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$group2 = GUICtrlCreateGroup("Liste de surveillance", 230, 5, 396, 175)
$survList = GUICtrlCreateListView("|Sujet |Auteur", 235, 22, 385, 106, _
BitOR($LVS_REPORT,$LVS_NOCOLUMNHEADER,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS))
GUICtrlSendMsg($survList, $LVM_SETCOLUMNWIDTH, 0, 20)
GUICtrlSendMsg($survList, $LVM_SETCOLUMNWIDTH, 1, 270)
GUICtrlSendMsg($survList, $LVM_SETCOLUMNWIDTH, 2, 70)
$survMenu = GUICtrlCreateContextMenu($survList)
$survMenuVire = GUICtrlCreateMenuItem("Supprimer", $survMenu)
$all_btn = GUICtrlCreateButton("surveiller tous les forums", 236, 132, 137, 18)
$news_btn = GUICtrlCreateButton("news", 378, 132, 42, 18)
GUICtrlSetTip(-1, "Voir les derniers messages")
GUICtrlCreateLabel("db-clic sur un sujet pour afficher sa page", 425, 133, 195, 16)
$ini_btn = GUICtrlCreateButton("ini", 240, 155, 35, 18)
$reset_btn = GUICtrlCreateButton("Reset", 280, 155, 50, 18)
GUICtrlCreateLabel("délai de vérification", 336, 158, 100, 18)
$d_input = GUICtrlCreateInput("", 431, 155, 30, 18)
GUICtrlCreateLabel("sec", 464, 158, 20, 18)
$exit_btn = GUICtrlCreateButton("Exit", 495, 155, 40, 18)
$ok_btn = GUICtrlCreateButton("Start", 548, 153, 70, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
If not @Compiled Then
InetGet("http://www.autoitscript.fr/images/favicon.ico", @tempdir & "\autoitfr.ico")
TraySetIcon (@tempdir & "\autoitfr.ico")
GuiSetIcon (@tempdir & "\autoitfr.ico")
EndIf
For $u = 0 To 6
GUICtrlSetTip($btn[$u], "voir tous les sujets de " & GuiCtrlRead($radio[$u], 1))
GUICtrlSetState($btn[$u], $GUI_DISABLE)
Next
GUICtrlSetState($btn[0], $GUI_ENABLE)
If NOT FileExists($ini) Then
IniWrite($ini, "divers", "delai", "15")
GuiCtrlSetData($d_input, "15")
IniWrite($ini, "divers", "exceptions", "")
Else
GuiCtrlSetData($d_input, IniRead($ini, "divers", "delai", "15"))
GuiCtrlSetData($e_input, IniRead($ini, "divers", "exceptions", ""))
EndIf
_RestoreSurvList()
TraySetState()
GUISetState()
GUIRegisterMsg($WM_MOUSEACTIVATE, "_Notif_OFF")
GUIRegisterMsg($WM_ACTIVATE, "WM_PAINT")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
_CheckZeNewMails()
While 1
If not WinActive($mainGui) AND $test_act = 0 Then $test_act = 1
$Tmsg = TrayGetMsg()
Switch $Tmsg
Case $T_gui, -13 ; $TRAY_EVENT_PRIMARYDOUBLE = -13, $TRAY_EVENT_PRIMARYDOWN = -7
_ShowHideGui()
Case $T_surv
_Surveillance()
Case $T_news
If BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
_ShowHideNews()
Case $T_ini
_ShowHideIni()
Case $T_exit
$started = 0
AdlibUnRegister()
_UpdateIni()
_Clean_Notifs()
If BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
Exit
EndSwitch
$msg = GuiGetMsg(1)
If $mails <> 0 Then
If $msg[1] = $hNotif_mail Then
$a = GUIGetCursorInfo($hNotif_mail)
If $a[0]<$Notif_W-30 Then ShellExecute($urlmail)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hNotif_mail, "int", 500, "long", 0x00050001)
$mails = 0
GUIDelete($hNotif_mail)
EndIf
EndIf
Switch $msg[0]
Case $GUI_EVENT_CLOSE
Switch $msg[1]
Case $listGui
GuiDelete($listGui)
$listguiexists = 0
If Not BitAnd(WinGetState($mainGui), 2) Then WinSetState($mainGui, "", @SW_SHOW)
Case $iniGui
_ShowHideIni()
Case $mainGui
_ShowHideGui()
If $traytip = 1 Then
TrayTip ("Surveillance forum", "Utiliser ce menu pour afficher ou masquer la fenêtre principale", 3 , 1)
$traytip = 0
EndIf
EndSwitch
Case $exit_btn
$started = 0
AdlibUnRegister()
_UpdateIni()
_Clean_Notifs()
If BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
Exit
Case $ini_btn
_ShowHideIni()
Case $reset_btn
If $started = 1 Then
$confirm = MsgBox (48+4, "Confirmer", "Surveillance en cours," &@CRLF& "Vider la liste quand même ?")
EndIf
If $started = 0 OR $confirm = 6 Then ; msgbox 'oui'
If $started = 1 Then
AdLibUnRegister("_getZeUpdatedMessage")
$started = 0
GUICtrlSetData($ok_btn, "Start")
EndIf
WinSetTitle($mainGui, "", "Surveillance arrêtée")
$allforums = 0
For $s = 0 To $survs-1
GUICtrlDelete($survArray[$s][0])
Next
FileDelete($ini)
IniWrite($ini, "divers", "delai", "15")
IniWrite($ini, "divers", "exceptions", "")
GuiCtrlSetData($d_input, IniRead($ini, "divers", "delai", "15"))
GuiCtrlSetData($e_input, IniRead($ini, "divers", "exceptions", ""))
$survs = 0
$survArray = ""
Dim $survArray[1][6]
_Clean_Notifs()
GUICtrlSetState($news_btn, $GUI_ENABLE)
TrayItemSetState($T_news, 64) ; $TRAY_ENABLE
EndIf
Case $ok_btn
_Surveillance()
Case $all_btn ; tous les forums
For $i = 0 To $survs-1
If $survArray[$i][3] = "Tous les forums" Then $allforums = 1
Next
If $allforums = 0 Then
SplashTextOn ("", "Chargement des données" & "...", 280, 55, -1, -1, 49)
$infos = _getInfosAboutZeTopics($urlportal)
If @error Then
SplashTextOn ("", "Erreur de chargement " & "...", 280, 55, -1, -1, 49)
Sleep(3000)
SplashOff()
Else
SplashOff()
$allforums = 1
$survs +=1
ReDim $survArray[$survs][6]
$survArray[$survs-1][0] = GUICtrlCreateListViewItem ("|" & "Tous les forums" , $survList) ; handle item
$survArray[$survs-1][1] = $infos[0][3] ; lien forum
$survArray[$survs-1][2] = $infos[0][4] ; date réponse
$survArray[$survs-1][3] = "Tous les forums" ; nom forum
$survArray[$survs-1][4] = "" ; $infos[0][6] ; index forum
$survArray[$survs-1][5] = "" ; $infos[0][1] ; auteur
GUICtrlSetImage($survArray[$survs-1][0], @SystemDir & "\shell32.dll", -206)
_SaveSurv()
EndIf
EndIf
Case $news_btn ; page de news
If BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
_ShowHideNews()
Case $survMenuVire
If $loading = 1 Then
Do
Sleep(10)
Until $loading = 0
EndIf
If ControlListView($mainGui, "", $survList, "IsSelected", $indexLV3) <> 0 Then
GUICtrlDelete($survArray[$indexLV3][0])
_ArrayDelete($survArray, $indexLV3)
IniDelete ($ini, $indexLV3)
For $i = $indexLV3+1 To $survs-1
IniRenameSection ($ini, $i, $i-1)
Next
$survs -=1
;_ArrayDisplay($survArray, "debug")
If $survArray = "" Then
AdLibUnRegister("_getZeUpdatedMessage")
$indexLV3 = ""
Dim $survArray[1][6]
EndIf
EndIf
EndSwitch
If $listguiexists = 1 Then
Switch $msg[0]
Case $gen_btn
$listTitle = WinGetTitle($listGui)
For $i = 0 To $survs-1
If $survArray[$i][3] = $listTitle Then $surv_gen = 1
Next
If $surv_gen = 0 Then
$survs +=1
ReDim $survArray[$survs][6]
$survArray[$survs-1][0] = GUICtrlCreateListViewItem ("|" & $listTitle , $survList) ; handle item
$survArray[$survs-1][1] = $urlforum & $infos[0][6] ; lien forum
$survArray[$survs-1][2] = $infos[0][4] ; date réponse
$survArray[$survs-1][3] = $listTitle ; nom forum
$survArray[$survs-1][4] = $infos[0][6] ; index forum
$survArray[$survs-1][5] = ""
GUICtrlSetImage($survArray[$survs-1][0], @SystemDir & "\shell32.dll", -206)
_SaveSurv()
$surv_gen = 1
EndIf
EndSwitch
EndIf
For $k = 0 To 6
Switch $msg[0]
Case $radio[$k]
For $u = 0 To 6
GUICtrlSetState($btn[$u], $GUI_DISABLE)
Next
GUICtrlSetState($btn[$k], $GUI_ENABLE)
;======================================== listview forums===========
Case $btn[$k]
ToolTip("")
$tip = 0
If $listguiexists = 1 Then
GuiDelete($listGui)
$surv_gen = 0
$infos = ""
EndIf
SplashTextOn ("", "Chargement du forum" & @crlf & GuiCtrlRead($radio[$k], 1) & "...", 280, 70, -1, -1, 49)
$infos = _getInfosAboutZeTopics($urlforum, $index[$k])
If @error Then
SplashTextOn ("", "Erreur de chargement de" & @crlf & GuiCtrlRead($radio[$k], 1) & "...", 280, 70, -1, -1, 49)
Sleep(3000)
SplashOff()
Else
SplashOff()
;#####################
;_getInfosAboutZeTopics($url, $ind) renvoie dans $infos tous les sujets du forum $url/$ind avec :
;$infos[$i][0] = titre du sujet
;$infos[$i][1] = auteur sujet
;$infos[$i][2] = auteur réponse
;$infos[$i][3] = lien vers la dernière réponse
;$infos[$i][4] = date de la dernière réponse
;$infos[$i][5] = lien vers le sujet
;$infos[$i][6] = $ind du forum
;###################
;_ArrayDisplay($infos & " debug", "Forum " & GuiCtrlRead($radio[$k], 1))
$mainpos = WinGetPos($mainGui)
$listGui = GUICreate("Forum " & GuiCtrlRead($radio[$k], 1), 400, 400, $mainpos[0]+660, 20)
$listview = GUICtrlCreateListView("Sujet |Auteur", 0, 0, 400, 363, _
BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS))
GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 0, 280)
GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 1, 100)
GuiCtrlCreateLabel("clic-droit sur un sujet pour l'ajouter à la liste de surveillance", 5, 366, 280, 17)
GuiCtrlCreateLabel("double-clic sur un sujet pour afficher sa page du forum", 10, 383, 280, 17)
$gen_btn = GuiCtrlCreateButton("Surveillance générale forum", 285, 365, 110, 32, 0x2000)
For $i = 0 To UBound($infos)-1
GUICtrlCreateListViewItem($infos[$i][0] & "|" & $infos[$i][1], $listview)
Next
If not @Compiled Then GuiSetIcon (@tempdir & "\autoitfr.ico")
GUISetState()
$listguiexists = 1
EndIf
;========================================================
EndSwitch
Next
Wend
;##########################################################################
;##########################################################################
Func _Surveillance() ; initialisation surveillance
If $started = 0 Then
If $survs = 0 Then
If BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
MsgBox(48, "Erreur liste", "La liste de surveillance est vide... ")
_ShowHideGui()
Else
$delai = GuiCtrlRead($d_input)
IniWrite($ini, "divers", "delai" , GuiCtrlRead($d_input))
If $delai < 10 Then $delai = 10
$delai = ($delai + $survs*5) *1000 ; $delai en secondes
If $listguiexists = 1 Then GuiDelete($listGui)
$infos = ""
WinSetTitle($mainGui, "", "Surveillance en cours")
AdLibRegister("_getZeUpdatedMessage", $delai) ; lance la surveillance
GUICtrlSetData($ok_btn, "Stop")
TrayItemSetText($T_surv, "Stopper la surveillance")
GUICtrlSetState($news_btn, $GUI_DISABLE)
TrayItemSetState($T_news, 128) ; $TRAY_DISABLE
$started = 1
If BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
EndIf
Else
$started = 0
WinSetTitle($mainGui, "", "Surveillance en pause")
AdLibUnRegister("_getZeUpdatedMessage")
GUICtrlSetData($ok_btn, "Start")
TrayItemSetText($T_surv, "Lancer la surveillance")
_Clean_Notifs()
GUICtrlSetState($news_btn, $GUI_ENABLE)
TrayItemSetState($T_news, 64) ; $TRAY_ENABLE
If NOT BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
EndIf
EndFunc ;==>_Surveillance
;################### $survList, par item :
;$i = index dans la liste de surv
;$survArray[$i][0] = handle de l'item $i
;$survArray[$i][1] = lien vers la dernière réponse
;$survArray[$i][2] = date dernière réponse
;$survArray[$i][3] = titre sujet
;$survArray[$i][4] = index du forum $ind
;$survArray[$i][5] = auteur
;$survs = nb d'items dans la liste
;###################
;##############
;_getZisMessage($url, $ind, $Fstring = " ") renvoie du forum $url/$ind
;$message[0] = titre du message contenant $Fstring
;$message[1] = lien dernière réponse (updt !)
;$message[2] = date dernière réponse (updt !)
;$message[3] = index forum
;$message[4] = auteur sujet
;$message[5] = auteur réponse (updt !)
;##############
;=======================================surveillance sujets==================
Func _getZeUpdatedMessage() ; gestion de la surveillance
Local $begin = TimerInit()
For $i = 0 To $survs-1
If $started = 0 Then Exitloop
$loading = 1
$notfound = 0
If $survArray[$i][5] = "" Then
$string = " "
Else
$string = StringTrimLeft(StringLeft($survArray[$i][3], 20), 5)
EndIf
Local $ind = $survArray[$i][4]
If $ind = "" Then
$message = _getZisMessage($urlportal, "", $string) ; check la page d'accueil
Else
$message = _getZisMessage($urlforum, $ind, $string) ; check les forums
EndIf
If @error OR $message = "" then
$g_eventerror = 0
Else
If $notfound = 1 Then
GUICtrlSetImage($survArray[$i][0], @SystemDir & "\shell32.dll", -132)
Else
If GuiCtrlRead($e_input) <> "" Then
$except = StringSplit(GuiCtrlRead($e_input), ",")
For $e = 1 to $except[0]
$except[$e] = StringRegExpReplace($except[$e], '^\s*|\s*$', "")
If $except[$e] = $message[5] Then $noNotif = 1
Next
EndIf
If $message[2] <> $survArray[$i][2] AND $noNotif = 0 Then
;########### pour tester : If $message[2] = ... , fonctionnement normal : If $message[2] <>...
_Notif_ON(StringRegExpReplace($message[2], '(\d{4} )', ""), _
_NomForum($message[3]), $message[0], $message[4], $message[5])
; date, forum, titre, auteur sujet, auteur réponse
$Notification[$nb_notifs][1] = $survArray[$i][3] ; titre (concordance liste gui)
$Notification[$nb_notifs][2] = $message[1] ; lien dernière réponse
;_ArrayDisplay($Notification, "debug")
$survArray[$i][1] = $message[1]
$survArray[$i][2] = $message[2]
GUICtrlSetImage($survArray[$i][0], @SystemDir & "\shell32.dll", -138)
For $m = 1 To 5
IniWrite($ini, $i, $m , $survArray[$i][$m] ) ; update ini
Next
EndIf
EndIf
EndIf
; _ArrayDisplay($survArray, "debug")
$noNotif = 0
$loading = 0
Next
Local $dif = Round(TimerDiff($begin)/1000) ; en sec
If $dif > ($delai-5) Then AdLibRegister("_getZeUpdatedMessage", $delai)
EndFunc
Func MyErrFunc()
$g_eventerror = 1
Endfunc ;==> _getZeUpdatedMessage
;=======================================WM_NOTIFY==================
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndForumListView, $hWndSurvListView
Local $tagNMHDR = "hwnd hWndFrom;uint_ptr IDFrom;INT Code"
$hWndForumListView = $listview
If Not IsHWnd($listview) Then $hWndForumListView = GUICtrlGetHandle($listview)
$hWndSurvListView = $survList
If Not IsHWnd($survList) Then $hWndSurvListView = GUICtrlGetHandle($survList)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndForumListView
Switch $iCode
Case $NM_DBLCLK
Local $indexLV0 = ControlListView($listGui, "", $hWndForumListView, "GetSelected")
ShellExecute(StringRegExpReplace($infos[$indexLV0][5], "#.+", ""))
Case $NM_RCLICK
Local $indexLV = ControlListView($listGui, "", $hWndForumListView, "GetSelected")
Local $sujetLV = ControlListView($listGui, "", $hWndForumListView, "GetText", $indexLV, 0)
For $i = 0 To $survs-1
If $survArray[$i][3] = $sujetLV Then Return
Next
Local $auteurLV = ControlListView($listGui, "", $hWndForumListView, "GetText", $indexLV, 1)
$survs +=1
ReDim $survArray[$survs][6]
$survArray[$survs-1][0] = GUICtrlCreateListViewItem ("|" & $sujetLV & "|" & $auteurLV, $survList) ; handle item
$survArray[$survs-1][1] = $infos[$indexLV][3] ; lien réponse
$survArray[$survs-1][2] = $infos[$indexLV][4] ; date réponse
$survArray[$survs-1][3] = $infos[$indexLV][0] ; titre
$survArray[$survs-1][4] = $infos[$indexLV][6] ; index forum
$survArray[$survs-1][5] = $infos[$indexLV][1] ; auteur
GUICtrlSetImage($survArray[$survs-1][0], @SystemDir & "\shell32.dll", -206)
_SaveSurv()
EndSwitch
Case $hWndSurvListView
Switch $iCode
Case $NM_DBLCLK
Local $indexLV2 = ControlListView($mainGui, "", $hWndSurvListView, "GetSelected")
If ControlListView($mainGui, "", $hWndSurvListView, "IsSelected", $indexLV2) <> 0 Then
GUICtrlSetImage($survArray[$indexLV2][0], @SystemDir & "\shell32.dll", -111)
ShellExecute($survArray[$indexLV2][1])
EndIf
Case $NM_RCLICK
$indexLV3 = ControlListView($mainGui, "", $hWndSurvListView, "GetSelected")
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
;======================================= affichage gui========================
Func _ShowHideGui()
If $mails <> 0 Then
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hNotif_mail, "int", 500, "long", 0x00050001)
GUIDelete($hNotif_mail)
EndIf
If BitAnd(WinGetState($mainGui), 2) Then
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $mainGui, "int", 200, "long", 0x00090000) ; fade-out
GuiSetState(@SW_HIDE, $mainGui)
TrayItemSetText($T_gui, "Restaurer la fenêtre")
Else
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $mainGui, "int", 200, "long", 0x00080000) ; fade-in
GuiSetState(@SW_SHOW, $mainGui)
_WinAPI_RedrawWindow($mainGui, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
_WinAPI_SetWindowPos($mainGui, 0, -1, -1, -1, -1, BitOR(0x0001, 0x0002))
; $HWND_TOP, $SWP_NOSIZE, $SWP_NOMOVE
TrayItemSetText($T_gui, "Réduire la fenêtre")
EndIf
EndFunc
;======================================= gestion du ini =======================
Func _ShowHideIni()
If NOT WinExists($ini) Then
Local $file = FileRead($ini)
$iniGui = GuiCreate($ini, 420, 200, 200, 50, -1, $DS_MODALFRAME)
$edit = GuiCtrlCreateEdit("", 0, 2, 420, 198, $WS_VSCROLL+0x0804)
GUICtrlSetBkColor(-1, 0xffffff)
GuiSetState()
GuiCtrlSetData($edit, $file)
TrayItemSetText($T_ini, "Fermer le ini")
Else
GuiDelete($iniGui)
TrayItemSetText($T_ini, "Voir le ini")
EndIf
EndFunc
Func _SaveSurv()
For $i = 1 To 5
IniWrite($ini, $survs-1, $i , $survArray[$survs-1][$i] )
Next
EndFunc
Func _UpdateIni()
IniWrite($ini, "divers", "delai" , GuiCtrlRead($d_input))
IniWrite($ini, "divers", "exceptions", GuiCtrlRead($e_input))
For $s = 0 to $survs-1
For $i = 1 To 5
IniWrite($ini, $s, $i , $survArray[$s][$i] )
Next
Next
EndFunc ;==>_ShowHideIni
Func _RestoreSurvList()
If FileExists($ini) Then
Local $var = IniReadSectionNames($ini)
If $var[0]>1 Then
$survs = $var[0]-1
Dim $survArray[$survs][6]
For $i = 0 To $survs-1
Local $ini_items = IniReadSection($ini, $i)
$survArray[$i][1] = $ini_items[1][1] ; lien réponse
$survArray[$i][2] = $ini_items[2][1] ; date réponse
$survArray[$i][3] = $ini_items[3][1] ; titre
$survArray[$i][4] = $ini_items[4][1] ; index forum
$survArray[$i][5] = $ini_items[5][1] ; auteur
$survArray[$i][0] = GUICtrlCreateListViewItem ("|" & $ini_items[3][1] & "|" & $ini_items[5][1], $survList) ; handle item
GUICtrlSetImage(-1, @SystemDir & "\shell32.dll", -206)
Next
EndIf
EndIf
EndFunc
;===================================données listview forums===================
Func _getInfosAboutZeTopics($F_url, $F_ind = "") ; listview forums
Do
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", $F_url & $F_ind)
$oHTTP.Send()
Until $g_eventerror =0
Local Const $txt = $oHTTP.Responsetext
$oHTTP = 0
Local Const $txt2 = StringRegExpReplace($txt, '(?s)(.*?)Sujets</b>', "")
Local $items = StringRegExp($txt2, '(?s)topictitle">(.*?)"><img', 3)
$items = _CleanStickys($txt2, $items)
If NOT IsArray($items) Then
SetError(1)
Return
EndIf
Local $viewtopics[UBound($items)][7]
For $i = 0 To UBound($items)-1
Local $F_string = $items[$i]
If StringInStr($F_string, "sid") Then _
$F_string = StringRegExpReplace($F_string, '(?s)(.+)&sid(.+)#(.+)', "$1"&"#"&"$3")
Local $titre = StringRegExpReplace($F_string, '(?s)(</a>.+)', "")
If StringInStr(StringLeft($titre, 4), "[.") Then $titre = StringRegExpReplace($titre, '^(.*?)\]', "") ; titre
$titre = _CleanHtmlShits($titre)
$viewtopics[$i][0] = $titre
$viewtopics[$i][1] = StringRegExpReplace($F_string, '(?s)(.*?)u=((.+?)>(.+?))</a>.+', "$4") ; auteur sujet
$viewtopics[$i][2] = StringRegExpReplace($F_string, '(?s)(.+)>(.+?)</a>.+', "$2") ; auteur réponse
$viewtopics[$i][4] = StringRegExpReplace($F_string, '(?s)(.+)nowrap;">([^<]+).+', "$2" ) ; date réponse
$viewtopics[$i][6] = StringRegExpReplace($F_string, '(?s)(.+)f=([^&]+).+', "$2") ; index forum
Local $adrtopic = StringRegExpReplace($F_string, '(?s)(.+)&t(.+)&p(.+)', "&t"&"$2"&"&p"&"$3")
$viewtopics[$i][3] = $urltopic & $viewtopics[$i][6] & $adrtopic ; lien réponse
$viewtopics[$i][5] = StringRegExpReplace($viewtopics[$i][3], "&p=.+", "") ; lien sujet
Next
Return $viewtopics ; pour l'array $infos
EndFunc ;==> _getInfosAboutZeTopics
;===============================récupération des données sujets==================
Func _getZisMessage($R_url, $R_ind, $Fstring = " ")
$message = ""
Dim $message[6]
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", $R_url & $R_ind)
$oHTTP.Send()
If $g_eventerror then Return
Local Const $txt = $oHTTP.Responsetext
$oHTTP = 0
Local Const $txt2 = StringRegExpReplace($txt, '(?s)(.*?)Sujets</b>', "")
Local $items2 = StringRegExp($txt2, '(?s)topictitle">(.*?)"><img', 3)
If NOT IsArray($items2) Then
SetError(1)
Return
EndIf
$items2 = _CleanStickys($txt2, $items2)
For $i = 0 To UBound($items2)-1
Local $R_string = $items2[$i]
Local $titre = StringRegExpReplace($R_string, '(?s)(</a>.+)', "")
If StringInStr($titre, $Fstring) Then
If StringInStr($R_string, "sid") Then _
$R_string = StringRegExpReplace($R_string, '(?s)(.+)&sid(.+)#(.+)', "$1"&"#"&"$3")
If StringInStr(StringLeft($titre, 4), "[.") Then $titre = StringRegExpReplace($titre, '^(.*?)\]', "") ; titre sujet
$titre = _CleanHtmlShits($titre)
$message[0] = $titre
$message[2] = StringRegExpReplace($R_string, '(?s)(.+)nowrap;">([^<]+).+', "$2" ) ; date réponse
$message[3] = StringRegExpReplace($R_string, '(?s)(.+)f=([^&]+).+', "$2") ; index forum
$message[4] = StringRegExpReplace($R_string, '(?s)(.*?)u=((.+?)>(.+?))</a>.+', "$4") ; auteur sujet
$message[5] = StringRegExpReplace($R_string, '(?s)(.+)>(.+?)</a>(.+)', "$2") ; auteur réponse
Local $adrtopic = StringRegExpReplace($R_string, '(?s)(.+)&t(.+)&p(.+)', "&t"&"$2"&"&p"&"$3")
$message[1] = $urltopic & $message[3] & $adrtopic ; lien réponse
Return $message
EndIf
Next
_checkPoubelle($Fstring) ; si message pas trouvé
EndFunc ;==> _getZisMessage
Func _CleanStickys($Codepage, $ItemArray) ; vire les topics 'sticky'
Local $sticky = 0
StringReplace($Codepage, "sticky", "")
If @error = 0 AND @Extended>1 Then $sticky = @Extended-1
If $sticky>0 Then
For $s = 0 To $sticky-1
If IsArray($ItemArray) Then _ArrayDelete($ItemArray, 0)
Sleep(10)
Next
EndIf
Return $ItemArray
EndFunc ;==>_CleanStickys
Func _checkPoubelle($Pstring)
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", $urlforum & "34")
$oHTTP.Send()
If $g_eventerror then Return
Local Const $txt = $oHTTP.Responsetext
$oHTTP = 0
Local Const $txt2 = StringRegExpReplace($txt, '(?s)(.*?)Sujets</b>', "")
Local Const $_titres = StringRegExp($txt2, '(?s)topictitle">(.*?)"><img', 3)
If IsArray($_titres) Then
For $i = 0 To UBound($_titres)-1
If StringInStr($_titres[$i], $Pstring) Then
$notfound = 1
MsgBox(48, " Désolé", "Le message contenant : " & $Pstring & " est à la poubelle ", 3)
Return
EndIf
Next
EndIf
$notfound = 1
; MsgBox(48, "Erreur", "Pas trouvé le message contenant : " & $Pstring, 3)
EndFunc ;==>_checkPoubelle
;=======================================gestion des notifications==================
Func _Clean_Notifs() ; ferme toutes les notifs et réinitialise
If $nb_notifs > 0 Then
For $i = $nb_notifs To 1 Step -1
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Notification[$i][0], "int", 500, "long", 0x00050001)
GUIDelete($Notification[$i][0])
Next
$Notification = ""
Dim $Notification[1][3]
$nb_notifs = 0
TrayItemSetState($T_news, 64) ; $TRAY_ENABLE
EndIf
If $nb_notifs_news > 0 Then
For $i = $nb_notifs_news To 1 Step -1
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Notif_news[$i][0], "int", 500, "long", 0x00050001)
GUIDelete($Notif_news[$i][0])
Next
$news = 0
$Notif_news = ""
Dim $Notif_news[1][3]
$nb_notifs_news = 0
TrayItemSetText($T_news, "News")
TrayItemSetState($T_surv, 64)
GUICtrlSetState($ok_btn, $GUI_ENABLE)
EndIf
EndFunc ;==>_Clean_Notifs
Func _Notif_ON($nDate, $nforum, $nMessage, $nAuteur, $nRep) ; notifs sujets
Local $Notif_Y = @DesktopHeight - 80 - (50 * ($nb_notifs + 1))
Local $hNotif = GUICreate("", $Notif_W, $Notif_H, $Notif_X, $Notif_Y, _
$WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_CLIENTEDGE))
GUISetBkColor(0xdde0e7)
GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -138, 6, 2, 16, 16)
GUICtrlCreateLabel("Répondu " & $nDate & " (" & $nforum & ")", 30, 2, $Notif_W-140, 16) ; (Titre G : date, forum)
GUICtrlSetFont(-1, 9, 800, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0x008020)
GUICtrlCreateLabel($nRep, $Notif_W-120, 2, 90, 16, 0x0002) ; (Titre D : auteur rep) $SS_RIGHT
GUICtrlSetFont(-1, 9, 800, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0x005090)
GUICtrlCreateLabel($nMessage & " (sujet de " & $nAuteur & " )" , 10, 20, $Notif_W-15, 16, 1) ; (sujet, auteur) $SS_CENTER
GUICtrlSetFont(-1, 9, 400, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0x004080)
GUICtrlCreateLabel(" X", $Notif_W-25, 2, 25, 18, 1)
GUICtrlSetFont(-1, 9, 800, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0xdd2020)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hNotif, "int", 1000, "long", 0x00040002) ; slide left
GUISetState(@SW_SHOWNOACTIVATE, $hNotif)
$nb_notifs += 1
ReDim $Notification[$nb_notifs + 1][3]
$Notification[$nb_notifs][0] = $hNotif
EndFunc ;==>_Notif_ON
Func _Notif_OFF($hWnd, $iMsg, $wParam, $lParam) ; fermeture notif
#forceref $iMsg, $wParam, $lParam
If $retracting Then Return
$retracting = True
If $news = 1 Then
If $hWnd = $Notif_news[$nb_notifs_news][0] Then
_Clean_Notifs()
If NOT BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
EndIf
For $i = $nb_notifs_news To 1 Step -1
If $hWnd = $Notif_news[$i][0] Then
Local $a = GUIGetCursorInfo($hWnd)
If $a[0]<$Notif_W-30 Then ShellExecute($Notif_news[$i][2])
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Notif_news[$i][0], "int", 500, "long", 0x00050001)
GUIDelete($Notif_news[$i][0])
For $j = $i To $nb_notifs_news-1
$Notif_news[$j][0] = $Notif_news[$j+1][0]
$Notif_news[$j][1] = "" ; $Notif_news[$j+1][1]
$Notif_news[$j][2] = $Notif_news[$j+1][2]
WinMove($Notif_news[$j][0], "", $Notif_X, @DesktopHeight - 80 - (50 * $j))
WinMove($Notif_news[$nb_notifs_news][0], "", $Notif_X, @DesktopHeight - 60 - (50 * $j))
Next
ReDim $Notif_news[$nb_notifs_news][3]
$nb_notifs_news -= 1
If $nb_notifs_news = 1 Then
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Notif_news[1][0], "int", 500, "long", 0x00050001)
GUIDelete($Notif_news[1][0])
$nb_notifs_news = 0
$news = 0
$Notif_news = ""
TrayItemSetState($T_surv, 64) ; $TRAY_ENABLE
TrayItemSetText($T_news, "News")
GUICtrlSetState($ok_btn, $GUI_ENABLE)
If NOT BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
EndIf
ExitLoop
EndIf
Next
Else
For $i = $nb_notifs To 1 Step -1
If $hWnd = $Notification[$i][0] Then
Local $a = GUIGetCursorInfo($hWnd)
For $j = 0 To $survs-1
Local $sujetLV2 = ControlListView($mainGui, "", $survList, "GetText", $j, 1)
If $sujetLV2 = $Notification[$i][1] Then
GUICtrlSetImage($survArray[$j][0], @SystemDir & "\shell32.dll", -111)
If $a[0]<$Notif_W-30 Then ShellExecute($Notification[$i][2])
EndIf
Next
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Notification[$i][0], "int", 500, "long", 0x00050001) ; slide right
GUIDelete($Notification[$i][0])
For $j = $i To $nb_notifs-1
$Notification[$j][0] = $Notification[$j+1][0]
$Notification[$j][1] = $Notification[$j+1][1]
$Notification[$j][2] = $Notification[$j+1][2]
WinMove($Notification[$j][0], "", $Notif_X, @DesktopHeight - 80 - (50 * $j))
Next
ReDim $Notification[$nb_notifs][3]
$nb_notifs -= 1
ExitLoop
EndIf
Next
EndIf
$retracting = False
Return $GUI_RUNDEFMSG
EndFunc ;==> _Notif_OFF
;======================================gestion des news==================
Func _ShowHideNews()
If $news = 0 Then
SplashTextOn ("", "Chargement des News" & "...", 280, 55, -1, -1, 49)
Local $infosP = _getInfosAboutZeTopics($urlportal)
If @error Then
SplashTextOn ("", "Erreur de chargement..." & "...", 280, 55, -1, -1, 49)
Sleep(3000)
SplashOff()
If NOT BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
Return
EndIf
SplashOff()
$news = 1
TrayItemSetState($T_surv, 128) ; $TRAY_DISABLE
GUICtrlSetState($ok_btn, $GUI_DISABLE)
$nb_notifs_news = 0
Dim $Notif_news[UBound($infosP)+2][3]
For $i = UBound($infosP) to 1 step -1
_Notif_Portal_ON($i , StringRegExpReplace($infosP[$i-1][4], '(\d{4} )', ""), _
_NomForum($infosP[$i-1][6]), $infosP[$i-1][0], $infosP[$i-1][1], $infosP[$i-1][2])
$Notif_news[$nb_notifs_news][2] = $infosP[$i-1][3]
If $i = 1 Then _Notif_Warning()
Next
TrayItemSetText($T_news, "Fermer les News")
Else
_Clean_Notifs()
If NOT BitAnd(WinGetState($mainGui), 2) Then _ShowHideGui()
EndIf
EndFunc
Func _Notif_Warning() ; notif pour fermeture des news
Local $Notif_Y = @DesktopHeight - 80 - (50 * ($nb_notifs_news + 1))
Local $hNotif = GUICreate("", $Notif_W, $Notif_H-20, $Notif_X, $Notif_Y+20, _
$WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_CLIENTEDGE))
GUISetBkColor(0xdde0e7)
GUICtrlCreateLabel("Fermer toutes les News", 0, 2, $Notif_W, 16, 1)
GUICtrlSetFont(-1, 9, 800, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0xcc2020)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hNotif, "int", 800, "long", 0x00040002) ; slide left
GUISetState(@SW_SHOWNOACTIVATE, $hNotif)
$nb_notifs_news += 1
;ReDim $Notif_news[$nb_notifs_news + 1][3]
$Notif_news[$nb_notifs_news][0] = $hNotif
EndFunc ;==>_Notif_Warning
Func _Notif_Portal_ON($nn, $nDate, $nforum, $nMessage, $nAuteur, $nRep) ; notifs news
Local $Notif_Y = @DesktopHeight - 80 - (50 * ($nb_notifs_news + 1))
Local $hNotif = GUICreate("", $Notif_W, $Notif_H, $Notif_X, $Notif_Y, _
$WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_CLIENTEDGE))
GUISetBkColor(0xdde0e7)
GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -138, 6, 2, 16, 16)
GUICtrlCreateLabel("News n°" & $nn & " " & $nDate & " (" & $nforum & ")", 30, 2, $Notif_W-100, 16) ; (Titre G : date, forum)
GUICtrlSetFont(-1, 9, 800, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0x008020)
GUICtrlCreateLabel($nRep, $Notif_W-110, 2, 90, 16, 0x0002) ; (Titre D : auteur rep) $SS_RIGHT
GUICtrlSetFont(-1, 9, 800, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0x005090)
GUICtrlCreateLabel($nMessage & " (sujet de " & $nAuteur & " )" , 10, 20, $Notif_W-15, 16, 1) ; (sujet, auteur) $SS_CENTER
GUICtrlSetFont(-1, 9, 400, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0x004080)
GUICtrlCreateLabel(" X", $Notif_W-20, 2, 20, 18, 1)
GUICtrlSetFont(-1, 9, 800, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0xdd2020)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hNotif, "int", 800, "long", 0x00040002) ; slide left
GUISetState(@SW_SHOWNOACTIVATE, $hNotif)
$nb_notifs_news += 1
;ReDim $Notif_news[$nb_notifs_news + 1][3]
$Notif_news[$nb_notifs_news][0] = $hNotif
EndFunc ;==>_Notif_Portal_ON
;============================================check message privé=============
Func _CheckZeNewMails()
Local $txt = BinaryToString(InetRead("http://www.autoitscript.fr/forum/index.php"), 1)
Local $res = StringRegExp($txt, 'strong>(.*?)nouveau', 3)
If NOT IsArray($res) Then Return
$mails = StringRegExpReplace($res[0], '\D', "" )
If $mails <> 0 Then _Notif_Mail($mails)
EndFunc
Func _Notif_Mail($nbmails)
Local $Notif_Y = @DesktopHeight - 110
$hNotif_mail = GUICreate("", $Notif_W, 25, $Notif_X, $Notif_Y, _
$WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_CLIENTEDGE))
GUISetBkColor(0xdde0e7)
GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -138, 6, 4, 16, 16)
If $nbmails=1 Then
GUICtrlCreateLabel("1 nouveau message privé", 30, 6, $Notif_W-80, 16, 1)
Else
GUICtrlCreateLabel($nbmails & " nouveaux messages privés", 30, 6, $Notif_W-80, 16, 1)
EndIf
GUICtrlSetFont(-1, 9, 800, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0x005090)
GUICtrlCreateLabel(" X", $Notif_W-25, 6, 20, 18, 1)
GUICtrlSetFont(-1, 9, 800, 0)
GUICtrlSetBkColor(-1, 0xdde0e7)
GUICtrlSetColor(-1, 0xdd2020)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hNotif_mail, "int", 800, "long", 0x00040002)
GUISetState(@SW_SHOWNOACTIVATE, $hNotif_mail)
EndFunc ;==>_Notif_Mail
;=============================================divers==================
Func _CleanHtmlShits($H_string)
If StringInStr($H_string, '<') Then $H_string = StringReplace($H_string, '<', '<')
If StringInStr($H_string, '>') Then $H_string = StringReplace($H_string, '>', '>')
If StringInStr($H_string, '"') Then $H_string = StringReplace($H_string, '"', '"')
If StringInStr($H_string, '&') Then $H_string = StringReplace($H_string, '&', '&')
Return $H_string
EndFunc
Func _NomForum($sonIndex)
Local $_Name
If $sonIndex = 3 Then $_Name = "Aide générale"
If $sonIndex = 4 Then $_Name = "Interface utilisateur"
If $sonIndex = 5 Then $_Name = "ActiveX-COM"
If $sonIndex = 6 Then $_Name = "Exemples de script"
If $sonIndex = 21 Then $_Name = "Fonctions et UDF"
If $sonIndex = 20 Then $_Name = "Demande de scripts"
If $sonIndex = 14 Then $_Name = "La vie du Forum"
If $sonIndex = 9 Then $_Name = "Chat"
If $sonIndex = 8 Then $_Name = "Présentation"
If $sonIndex = 11 Then $_Name = "Tutoriels"
If $sonIndex = 2 Then $_Name = "Nouvelles au3"
Return $_Name
EndFunc
Func WM_PAINT($hWnd, $msg, $wParam, $lParam)
#forceref $msg, $wParam, $lParam
If $test_act = 1 AND $hWnd = $mainGui Then
_WinAPI_RedrawWindow($mainGui, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
$test_act = 0
EndIf
Return $GUI_RUNDEFMSG
EndFunc
Func _WinAPI_RedrawWindow($hWnd, $tRect = 0, $hRegion = 0, $iFlags = 5)
Local $pRect = 0
If $tRect <> 0 Then $pRect = DllStructGetPtr($tRect)
Local $aResult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hWnd, _
"ptr", $pRect, "handle", $hRegion, "uint", $iFlags)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0]
EndFunc ;==>_WinAPI_RedrawWindow
Func _WinAPI_SetWindowPos($hWnd, $hAfter, $iX, $iY, $iCX, $iCY, $iFlags)
Local $aResult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hWnd, _
"hwnd", $hAfter, "int", $iX, "int", $iY, "int", $iCX, "int", $iCY, "uint", $iFlags)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0]
EndFunc ;==>_WinAPI_SetWindowPos
Func _Singleton($sOccurenceName, $iFlag = 0)
Local Const $ERROR_ALREADY_EXISTS = 183
Local Const $SECURITY_DESCRIPTOR_REVISION = 1
Local $handle, $lastError, $pSecurityAttributes = 0
If BitAND($iFlag, 2) Then
Local $structSecurityDescriptor = DllStructCreate("dword[5]")
Local $pSecurityDescriptor = DllStructGetPtr($structSecurityDescriptor)
Local $aRet = DllCall("advapi32.dll", "int", "InitializeSecurityDescriptor", _
"ptr", $pSecurityDescriptor, "dword", $SECURITY_DESCRIPTOR_REVISION)
If Not @error And $aRet[0] Then
$aRet = DllCall("advapi32.dll", "int", "SetSecurityDescriptorDacl", _
"ptr", $pSecurityDescriptor, "int", 1, "ptr", 0, "int", 0)
If Not @error And $aRet[0] Then
Local $structSecurityAttributes = DllStructCreate("dword;ptr;int")
DllStructSetData($structSecurityAttributes, 1, DllStructGetSize($structSecurityAttributes))
DllStructSetData($structSecurityAttributes, 2, $pSecurityDescriptor)
DllStructSetData($structSecurityAttributes, 3, 0)
$pSecurityAttributes = DllStructGetPtr($structSecurityAttributes)
EndIf
EndIf
EndIf
$handle = DllCall("kernel32.dll", "int", "CreateMutex", "ptr", $pSecurityAttributes, "long", 1, "str", $sOccurenceName)
$lastError = DllCall("kernel32.dll", "int", "GetLastError")
If $lastError[0] = $ERROR_ALREADY_EXISTS Then
If BitAND($iFlag, 1) Then
Return SetError($lastError[0], $lastError[0], 0)
Else
Exit -1
EndIf
EndIf
Return $handle[0]
EndFunc ;==>_Singleton
forums 5.32.au3
- (40.01 Kio) Téléchargé 412 fois