Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListBox.au3>
$Form2 = GUICreate("Form2", 391, 298, 210, 149)
$Input = GUICtrlCreateInput("", 135, 12, 241, 21)
GUICtrlCreateLabel("AJOUTER UNE LIGNE", 8, 16, 115, 17)
$B_add = GUICtrlCreateButton("AJOUTER", 208, 56, 75, 25, $WS_GROUP)
$B_del = GUICtrlCreateButton("SUPPRIMER", 296, 56, 83, 25, $WS_GROUP)
GUICtrlCreateLabel("LES LIGNES AJOUTEES", 16, 104, 125, 17)
$liste = _GUICtrlListBox_Create($Form2, "", 16, 136, 361, 150)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $B_add
$read = GUICtrlRead($Input)
If $read <> "" Then
$index_Ajoute = _GUICtrlListBox_InsertString($liste, $read)
; #####
IniWrite("fichier.ini", "Section", "Entrée_" & $index_Ajoute, $read)
; #####
EndIf
Case $B_del
$index = _GUICtrlListBox_GetAnchorIndex($liste)
_GUICtrlListBox_DeleteString($liste, $index)
EndSwitch
WEnd