[R] Alterner couleur ListView
Posté : sam. 29 mars 2014 12:00
par Hugues
Bonjour,
Je développe actuellement un petit logiciel pour la gestion de matériel. La base de données est SQLite.
Pour le moment tout ce passe bien, j'arrive à créer, enregistrer, modifier les données... Jusque là tout est OK.
Je voudrais colorer une ligne sur 2 de ma ListView pour un confort visuel.
Mikell m'avais aidé sur ce POST similaire http://www.autoitscript.fr/forum/viewto ... =3&t=10699, mais là je n'arrive pas à récupérer le nombre de ligne enregistrées dans ma base SQLite...
Je sais qu'il existe la fonction, mais elle me retourne toujours 0...
Je joins mon code complet, IL FAUT CRÉER UN FICHIER "FAMILLE.INI", pour modifier ou faire un retrait, il faut sélectionner une ligne au préalable.
Merci par avance.
Je développe actuellement un petit logiciel pour la gestion de matériel. La base de données est SQLite.
Pour le moment tout ce passe bien, j'arrive à créer, enregistrer, modifier les données... Jusque là tout est OK.
Je voudrais colorer une ligne sur 2 de ma ListView pour un confort visuel.
Mikell m'avais aidé sur ce POST similaire http://www.autoitscript.fr/forum/viewto ... =3&t=10699, mais là je n'arrive pas à récupérer le nombre de ligne enregistrées dans ma base SQLite...
Je sais qu'il existe la fonction
Code : Tout sélectionner
_SQLite_LastInsertRowID()
Je joins mon code complet, IL FAUT CRÉER UN FICHIER "FAMILLE.INI", pour modifier ou faire un retrait, il faut sélectionner une ligne au préalable.
Merci par avance.
► Afficher le texte
Code : Tout sélectionner
[FAMILLE]
1=TOTO
2=TATA
3=TUTU
► Afficher le texte
Code : Tout sélectionner
;==[ Création ]========: 27/03/2014
;==[ Auteur ]==========: MySelf
;==[ Service ]=========:
;==[ Description ]=====: Gestion magasin de proximité
;==[ Modification ]====: **/**/****
;==[ Nature modification ]====:
;==[**/**/20*** ****************************************]========
;==[**/**/20*** ****************************************]========
;==[**/**/20*** ****************************************]========
;==[**/**/20*** ****************************************]========
;==[Les Includes]====
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
;#include <ArrayFileToArray.au3>
#include <Timers.au3>
#include <SendMessage.au3>
#include <ProgressConstants.au3>
#include <GuiStatusBar.au3>
#include <Date.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <MsgBoxConstants.au3>
#include <Array.au3>
#include <ComboConstants.au3>
;==[Variables Globales]==========
Global $DB = @ScriptDir & "\ProxiMagMOE2.db"
Global $Table = "Material"
Global $User = @UserName
Global $hGui, $aLV_Click_Info, $hTmp_Edit, $fDblClk = False, $List1, $GUI, $iTimer1, $hStatus, $aParts[3] = [250, 400, 200]
Global $aTableau1, $Path, $Date, $Station, $PointMesure, $NomFichier, $Extension, $FullPathFile, $nb_col, $NbLineInDB, $hListView, $IndexItemListView
;==[Création Base SQLite]==========
SplashTextOn("", "Chargement données en cours...", 450, 55, -1, -1, 49)
_SQLite_Startup()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
If Not FileExists($DB) Then
$Reponse = MsgBox(16, "ProxiMagMOE2 Admin", "Base de données introuvable." & @CRLF & "Contactez le responsable application.")
If StringUpper(@UserName) = $User Then
If $Reponse = 1 Then
_CreateDB()
Else
Exit
EndIf
EndIf
EndIf
;==[Récupération du nom des colonnes de la Table "Material" dans un tableau]==========
_SQLite_Open($DB)
If @error > 0 Then Exit MsgBox(16, "SQLite Error", "Impossible de créer la Base de donnée!")
$names = _GetColNames("Material")
;_ArrayDisplay($names, "Nom des colonnes")
SplashOff()
_MainGui()
Func _MainGui()
;==[Création du GUI]===============================================================================================
$GUI = GUICreate("Magasin de Proximité - Powered By MySelf", 1200, 800, -1, -1, -1, -1)
$Label1 = GUICtrlCreateLabel("Quantité retirée:", 8, 10, 97, 20)
Global $Input1 = GUICtrlCreateInput("1", 112, 8, 89, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY))
GUICtrlSetLimit(-1, 3)
$bQuantiteDown = GUICtrlCreateButton("-", 216, 8, 75, 25)
$bQuantiteUp = GUICtrlCreateButton("+", 296, 8, 75, 25)
$bValiderRetrait = GUICtrlCreateButton("Valider le retrait", 8, 48, 155, 25)
$bNewEntry = GUICtrlCreateButton("Nouvelle entrée", 8, 80, 155, 25)
$bModify = GUICtrlCreateButton("Modifier entrée", 8, 112, 155, 25)
;==[On masque si pas administrateur]==========
If StringUpper(@UserName) <> $User Then
GUICtrlSetState($bNewEntry, $GUI_HIDE)
GUICtrlSetState($bModify, $GUI_HIDE)
EndIf
$ligne1 = ""
For $i = 0 to UBound($names)-1 ; nb de colonnes
$ligne1 &= $names[$i] & "|"
Next
;==[Création de ma ListView]==========
$hListView = GUICtrlCreateListView($ligne1, 0, 250, 1200, 500, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
$List1 = GuiCtrlGetHandle($hListView)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUICtrlSetFont($hListView, -1, 400)
GUICtrlSetBkColor($hListView, $GUI_BKCOLOR_LV_ALTERNATE)
_GUICtrlListView_DeleteAllItems($hListView)
_GUICtrlListView_HideColumn($hListView, 0)
_LoadSQLiteData()
GUISetState(@SW_SHOW)
;AdlibRegister("_MoveGui")
;GUIRegisterMsg($WM_SIZE, "WM_SIZE"
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
_SQLite_Close()
_SQLite_Shutdown()
Exit
Case $Msg = $bQuantiteDown
If GUICtrlRead($Input1) = 1 Then
GUICtrlSetData($Input1, "1")
Else
GUICtrlSetData($Input1, GUICtrlRead($Input1) - 1)
EndIf
Case $Msg = $bQuantiteUp
GUICtrlSetData($Input1, GUICtrlRead($Input1) + 1)
Case $Msg = $bNewEntry
_PopUp()
Case $Msg = $bModify
_ModifyEntryDB()
Case $Msg = $bValiderRetrait
_ModifyQuantityStock()
EndSelect
WEnd
EndFunc
Func _PopUp()
Global $Info = GUICreate("ProxiMagMOE2 - Nouvelle entrée", 382, 358, 650, 273)
$Label1 = GUICtrlCreateLabel("Emplacement:", 8, 10, 90, 20)
Global $iEmplacement = GUICtrlCreateInput("", 104, 8, 153, 24)
$Label2 = GUICtrlCreateLabel("Famille:", 48, 42, 51, 20)
Global $iDesignation = GUICtrlCreateInput("", 104, 72, 153, 24)
Global $iReference = GUICtrlCreateInput("", 104, 104, 153, 24)
Global $iRefMHP = GUICtrlCreateInput("", 104, 136, 153, 24)
Global $iStock = GUICtrlCreateInput("", 104, 168, 153, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
Global $iFabricant = GUICtrlCreateInput("", 104, 200, 153, 24)
Global $iFournisseur = GUICtrlCreateInput("", 104, 232, 153, 24)
Global $iObservations = GUICtrlCreateInput("", 104, 264, 153, 24)
$Label3 = GUICtrlCreateLabel("Désignation:", 24, 74, 79, 20)
$Label4 = GUICtrlCreateLabel("Référence:", 32, 106, 70, 20)
$Label5 = GUICtrlCreateLabel("Référence MHP:", 0, 138, 103, 20)
$Label6 = GUICtrlCreateLabel("Stock:", 64, 170, 41, 20)
$Label7 = GUICtrlCreateLabel("Fabricant:", 40, 202, 63, 20)
$Label8 = GUICtrlCreateLabel("Fournisseur:", 24, 234, 77, 20)
$Label9 = GUICtrlCreateLabel("Observations:", 16, 266, 87, 20)
$bValiderNewEntry = GUICtrlCreateButton("Valider", 72, 304, 75, 25)
$bCancelNewEntry = GUICtrlCreateButton("Annuler", 240, 304, 75, 25)
Global $cFamille = GUICtrlCreateCombo("", 104, 40, 153, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $CBS_DROPDOWNLIST))
;Ajout items dans la ComboBox via le fichier Config.ini
Local $CAT = IniReadSection(@ScriptDir & "\Famille.ini", "FAMILLE")
If @error Then
MsgBox(48, "Administrateur", "Erreur d'ouverture fichier Config.ini." & @CRLF & "-> Sortie de programme")
Exit
Else
For $i = 1 To $CAT[0][0]
GUICtrlSetData($cFamille, $CAT[$i][1])
Next
EndIf
GUISetState(@SW_SHOW)
While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
GUIDelete($Info)
ExitLoop
Case $Msg = $bValiderNewEntry
_CheckNewEntry()
;GUIDelete($Info)
;ExitLoop
Case $Msg = $bCancelNewEntry
GUIDelete($Info)
ExitLoop
EndSelect
WEnd
EndFunc
Func _PopUpModify()
Local $hQuery, $aRow, $sMsg
;_SQLite_Open ($bdd)
$IndexItemListView = _GUICtrlListView_GetNextItem($hListView)
Global $aItem = _GUICtrlListView_GetItemText($hListView, $IndexItemListView)
_SQlite_Query (-1, "SELECT * FROM " & $Table & " WHERE ID = " & $aItem & ";", $hQuery) ; the query
While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
$sMsg &= $aRow[0] & "|" &$aRow[1] & "|" &$aRow[2] & "|" &$aRow[3] & "|" &$aRow[4] & "|" &$aRow[5] & "|" &$aRow[6] & "|" &$aRow[7] & "|" &$aRow[8] & "|" &$aRow[9]
WEnd
$aRow=StringSplit($sMsg,"|")
Global $Info2 = GUICreate("ProxiMagMOE2 - Nouvelle entrée", 382, 358, 650, 273)
$Label1 = GUICtrlCreateLabel("Emplacement:", 8, 10, 90, 20)
Global $iEmplacement2 = GUICtrlCreateInput("", 104, 8, 153, 24)
$Label2 = GUICtrlCreateLabel("Famille:", 48, 42, 51, 20)
Global $iDesignation2 = GUICtrlCreateInput("", 104, 72, 153, 24)
Global $iReference2 = GUICtrlCreateInput("", 104, 104, 153, 24)
Global $iRefMHP2 = GUICtrlCreateInput("", 104, 136, 153, 24)
Global $iStock2 = GUICtrlCreateInput("", 104, 168, 153, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
Global $iFabricant2 = GUICtrlCreateInput("", 104, 200, 153, 24)
Global $iFournisseur2 = GUICtrlCreateInput("", 104, 232, 153, 24)
Global $iObservations2 = GUICtrlCreateInput("", 104, 264, 153, 24)
$Label3 = GUICtrlCreateLabel("Désignation:", 24, 74, 79, 20)
$Label4 = GUICtrlCreateLabel("Référence:", 32, 106, 70, 20)
$Label5 = GUICtrlCreateLabel("Référence MHP:", 0, 138, 103, 20)
$Label6 = GUICtrlCreateLabel("Stock:", 64, 170, 41, 20)
$Label7 = GUICtrlCreateLabel("Fabricant:", 40, 202, 63, 20)
$Label8 = GUICtrlCreateLabel("Fournisseur:", 24, 234, 77, 20)
$Label9 = GUICtrlCreateLabel("Observations:", 16, 266, 87, 20)
$bValiderNewEntry = GUICtrlCreateButton("Valider", 72, 304, 75, 25)
$bCancelNewEntry = GUICtrlCreateButton("Annuler", 240, 304, 75, 25)
Global $cFamille2 = GUICtrlCreateCombo("", 104, 40, 153, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $CBS_DROPDOWNLIST))
;Ajout items dans la ComboBox via le fichier Config.ini
Local $CAT = IniReadSection(@ScriptDir & "\Famille.ini", "FAMILLE")
If @error Then
MsgBox(48, "Administrateur", "Erreur d'ouverture fichier Config.ini." & @CRLF & "-> Sortie de programme")
Exit
Else
For $i = 1 To $CAT[0][0]
GUICtrlSetData($cFamille2, $CAT[$i][1])
Next
EndIf
GUICtrlSetData($iEmplacement2, $aRow[2])
GUICtrlSetData($iDesignation2, $aRow[4])
GUICtrlSetData($iReference2, $aRow[5])
GUICtrlSetData($iRefMHP2, $aRow[6])
GUICtrlSetData($iStock2, $aRow[7])
GUICtrlSetData($iFabricant2, $aRow[8])
GUICtrlSetData($iFournisseur2, $aRow[9])
GUICtrlSetData($iObservations2, $aRow[10])
GUISetState(@SW_SHOW)
While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
GUIDelete($Info2)
ExitLoop
Case $Msg = $bValiderNewEntry
_UpDateDB()
GUIDelete($Info2)
ExitLoop
Case $Msg = $bCancelNewEntry
GUIDelete($Info2)
ExitLoop
EndSelect
WEnd
EndFunc
Func _UpDateDB()
_SQLite_Exec (-1, "UPDATE " & $Table & " SET Emplacement = '" & GUICtrlRead($iEmplacement2) & "', Famille = '" & GUICtrlRead($cFamille2) & "', Désignation = '" & GUICtrlRead($iDesignation2) & "', Référence = '"& GUICtrlRead($iReference2) & "', MHP = '" & GUICtrlRead($iRefMHP2) & "', Stock = '" & GUICtrlRead($iStock2) & "', Fabricant = '" & GUICtrlRead($iFabricant2) & "', Fournisseur = '" & GUICtrlRead($iFournisseur2) & "', Observations = '" & GUICtrlRead($iObservations2) & "' WHERE ID = "& $aItem & ";")
_LoadSQLiteData()
EndFunc
Func _ModifyQuantityStock()
Local $hQuery, $aRow, $sMsg, $PartToRemove
If _GUICtrlListView_GetNextItem($hListView) = -1 And _GUICtrlListView_GetItemText($hListView, $IndexItemListView) = "" Then Return
$IndexItemListView = _GUICtrlListView_GetNextItem($hListView)
$aItem = _GUICtrlListView_GetItemText($hListView, $IndexItemListView)
;On récupère la quantité de la base SQLite
_SQlite_Query (-1, "SELECT * FROM " & $Table & " WHERE ID = " & $aItem & ";", $hQuery) ; the query
While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
$sMsg &= $aRow[6]
WEnd
If $sMsg = 0 Then Return
If StringUpper(@UserName) = $User And _GUICtrlListView_GetNextItem($hListView) <> -1 Then
$Question = MsgBox(68, "ProxiMagMOE2", "Voulez-vous retirer " & GUICtrlRead($Input1) & " " & _GUICtrlListView_GetItemText($hListView, $IndexItemListView, 3) & " du stock?" , -1, $GUI)
If $Question = 6 Then
If Number(GUICtrlRead($Input1)) > Number($sMsg) Then
MsgBox(16, "ProxiMagMOE2", "Le nombre de pièce à retirer est supérieur au stock actuel.")
Return
Else
$PartToRemove = $sMsg - GUICtrlRead($Input1)
EndIf
If $PartToRemove = 0 Then
MsgBox(0, "", "Plus de pièces en stock après retrait" & @CRLF & "Contactez le responsable pièce de rechange.")
_SQLite_Exec (-1, "UPDATE " & $Table & " SET Stock = '" & $PartToRemove & "' WHERE ID = "& $aItem & ";")
Else
_SQLite_Exec (-1, "UPDATE " & $Table & " SET Stock = '" & $PartToRemove & "' WHERE ID = "& $aItem & ";")
EndIf
_LoadSQLiteData()
Else
Return
EndIf
EndIf
EndFunc
Func _CheckNewEntry()
Select
Case GUICtrlRead($iEmplacement) = ""
MsgBox(48, "Administrateur" , "Veuillez saisir un emplacement!" & @CRLF & "Exemple: E0.2.1.01", -1, $Info)
Return
Case GUICtrlRead($cFamille) = ""
MsgBox(48, "Administrateur", "Veuillez choisir une famille!", -1, $Info)
Return
Case GUICtrlRead($iDesignation) = ""
MsgBox(48, "Administrateur", "Veuillez saisir une désignation!", -1, $Info)
Return
Case GUICtrlRead($iReference) = ""
MsgBox(48, "Administrateur", "Veuillez saisir une référence!", -1, $Info)
Return
Case GUICtrlRead($iRefMHP) = ""
MsgBox(48, "Administrateur", "Veuillez saisir une référence MHP!", -1, $Info)
Return
Case GUICtrlRead($iStock) = ""
MsgBox(48, "Administrateur", "Veuillez saisir un stock!", -1, $Info)
Return
Case GUICtrlRead($iFabricant) = ""
MsgBox(48, "Administrateur", "Veuillez saisir un fabricant!", -1, $Info)
Return
Case GUICtrlRead($iFournisseur) = ""
MsgBox(48, "Administrateur", "Veuillez saisir un fournisseur!", -1, $Info)
Return
Case GUICtrlRead($iObservations) = ""
MsgBox(48, "Administrateur", "Veuillez saisir une observation!", -1, $Info)
Return
EndSelect
_InsertDataIntoDB()
EndFunc
Func _LoadSQLiteData()
_GUICtrlListView_DeleteAllItems($hListView)
Local $hQuery, $aRow, $sMsg, $iRows, $iCols
If @error > 0 Then Exit MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
$DB = _SQLite_Open("ProxiMagMOE2.db")
If @error > 0 Then Exit MsgBox(16, "SQLite Error", "Can't Load Database!")
_SQLite_Query ($DB, "SELECT * FROM Material", $hQuery )
While (_SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK)
GUICtrlCreateListViewItem($aRow[0] & "|" & $aRow[1] & "|" & $aRow[2] & "|" & $aRow[3] & "|" & $aRow[4] & "|" & $aRow[5] & "|" & $aRow[6] & "|" & $aRow[7] & "|" & $aRow[8] & "|" & $aRow[9], $hListView)
WEnd
EndFunc
Func _CreateDB()
_SQLite_Open($DB)
If @error > 0 Then Exit MsgBox(16, "SQLite Error", "Impossible de créer la Base de donnée!")
_SQLite_Exec(-1, "CREATE TABLE " & $Table & " (ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Emplacement ,Famille, Désignation, Référence, MHP, Stock, Fabricant, Fournisseur, Observations);")
;_SQLite_Close()
EndFunc
Func _InsertDataIntoDB()
If @error > 0 Then Exit MsgBox(16, "SQLite Error", "Impossible de lire la Base de donnée!")
_SQLite_Exec(-1, "Insert Into Material Values (NULL, " & _
"'" & GUICtrlRead($iEmplacement) & _
"', '" & GUICtrlRead($cFamille) & _
"', '" & GUICtrlRead($iDesignation) & _
"', '" & GUICtrlRead($iReference) & _
"', '" & GUICtrlRead($iRefMHP) & _
"', '" & GUICtrlRead($iStock) & _
"', '" & GUICtrlRead($iFabricant) & _
"', '" & GUICtrlRead($iFournisseur) & _
"', '" & GUICtrlRead($iObservations) & _
"');")
MsgBox(64, "ProxiMagMOE2", "Données correctement enregistrées dans la base de données.", -1, $Info)
GUICtrlSetData($iEmplacement, "")
GUICtrlSetData($iDesignation, "")
GUICtrlSetData($iReference, "")
GUICtrlSetData($iRefMHP, "")
GUICtrlSetData($iStock, "")
GUICtrlSetData($iFabricant, "")
GUICtrlSetData($iFournisseur, "")
GUICtrlSetData($iObservations, "")
_LoadSQLiteData()
EndFunc
Func _ModifyEntryDB()
If _GUICtrlListView_GetNextItem($hListView) = -1 And _GUICtrlListView_GetItemText($hListView, $IndexItemListView) = "" Then Return
$IndexItemListView = _GUICtrlListView_GetNextItem($hListView)
$aItem = _GUICtrlListView_GetItemText($hListView, $IndexItemListView)
If StringUpper(@UserName) = $User And _GUICtrlListView_GetNextItem($hListView) <> -1 Then
$Question = MsgBox(68, "ProxiMagMOE2", "Voulez-vous modifier l'entrée " & _GUICtrlListView_GetItemText($hListView, $IndexItemListView, 3) & "?" , -1, $GUI)
If $Question = 6 Then
_PopUpModify()
Else
Return
EndIf
EndIf
EndFunc
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $Index, $tNMITEMACTIVATE, $Index2
Local $hQuery
Local $hWndListView = $hListView
If Not IsHWnd($hWndListView) Then $hWndListView = GUICtrlGetHandle($hListView)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$tNMITEMACTIVATE = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
$Index = DllStructGetData($tNMHDR, "Index")
$Index2 = DllStructGetData($tNMITEMACTIVATE, 'Index')
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $NM_RCLICK
If _GUICtrlListView_GetNextItem($hListView) = -1 And _GUICtrlListView_GetItemText($hListView, $IndexItemListView) = "" Then Return
If StringUpper(@UserName) <> $User Then Return
If StringUpper(@UserName) = $User And _GUICtrlListView_GetNextItem($hListView) <> -1 Then
$Question = MsgBox(20, "ProxiMagMOE2", "Voulez-vous vraiment supprimer cette entrée?", -1, $GUI)
If $Question = 6 Then
$IndexItemListView = _GUICtrlListView_GetNextItem($hListView)
$aItem = _GUICtrlListView_GetItemText($hListView, $IndexItemListView)
_SQlite_Query (-1, "SELECT * FROM Material WHERE ID = " & $aItem & ";", $hQuery)
$req =_SQLite_Exec (-1, "DELETE FROM Material WHERE ID = " & $aItem & ";")
If $req <> $SQLITE_OK Then Exit MsgBox(0,"Une erreur est survenue", "Effacement impossible.", -1, $GUI)
_LoadSQLiteData()
Else
Return
EndIf
EndIf
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
Func _GetColNames($tab)
Local $hQuery, $aNames
_SQLite_Query(-1, "SELECT * FROM '" & $tab & "';", $hQuery)
_SQLite_FetchNames($hQuery, $aNames)
Return $aNames
EndFunc
Func _MoveGui()
;==[Taille de la barre de tâches pour définir taille de mon GUI]====
Local $aPos = WinGetPos("[CLASS:Shell_TrayWnd]")
Local $left = $aPos[0]
Local $top = $aPos[1]
Local $Width = $aPos[2]
Local $Height = $aPos[3]
Local $w, $h, $x, $y
;==[Détermination de la position de la barre de tâche]====
;Barre de tâche en bas de l'écran
If $left = 0 And $Width = @DesktopWidth And $top = (@DesktopHeight - $aPos[3]) Then
$w = $width - 10
$h = @DesktopHeight - $height - 10
$x = 5
$y = 5
EndIf
;Barre de tâche en haut de l'écran
If $left= 0 And $Width = @DesktopWidth And $top = 0 Then
$w = $width - 10
$h = @DesktopHeight - $Height - 10
$x = 5
$y = $Height + 5
EndIf
;Barre de tâche à gauche de l'écran
If $left= 0 And $top = 0 And $Height = @DesktopHeight Then
$w = @DesktopWidth - $Width - 10
$h = $Height - 10
$x = $Width + 5
$y = 5
EndIf
;Barre de tâche à droite de l'écran
If $left <> 0 And $top = 0 And $Height = @DesktopHeight Then
$w = @DesktopWidth - $Width - 10
$h = $Height - 10
$x = 5
$y = 5
EndIf
;Barre de tâche masquée
If $left= 0 And $Width = @DesktopWidth And $top = @DesktopHeight - 2 Then
$w = @DesktopWidth - 10
$h = @DesktopHeight - 10
$x = 5
$y = 5
EndIf
Local $aGuiPos = WinGetPos($hGui)
If $aGuiPos[0] <> $x OR $aGuiPos[1] <> $y OR $aGuiPos[2] <> $w OR $aGuiPos[3] <> $h Then WinMove($hGUI, "", $x, $y, $w, $h)
EndFunc