Bonjour à tous,
Voilà premier gros blocage, j'explique tout dans la vidéo.
https://youtu.be/RbWPq5ribzQ
Je met le code actuel
GuiStatusBarEx.au3
Code : Tout sélectionner
#include-once
#include <GuiStatusBar.au3>
#include <ButtonConstants.au3>
#include <Color.au3>
#include <ComboConstants.au3>
#include <Date.au3>
#include <GuiComboBox.au3>
#include <FontConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WinAPISys.au3>
#include <WinAPITheme.au3>
#include <WindowsConstants.au3>
#include <Array.au3> ; _ArrayDisplay($aArray, "Infos")
; #INDEX# =======================================================================================================================
; Title .........: StatusBarEx
; AutoIt Version : 3.3.14.5
; Date ..........: 24/04/2020, 11h15
; Language ......: English
; Description ...: Functions that assist with StatusBarEx control management.
; A status bar Ex is a horizontal window at the bottom of a parent window in which an application can display
; various kinds of status information. The status bar can be divided into parts to display more than one type
; of information
; Author(s) .....: Anthony Baillou (Anthony) <https://www.autoitscript.fr/forum/memberlist.php?mode=viewprofile&u=3388>
; ===============================================================================================================================
; #VARIABLES# ===================================================================================================================
Global $exstyle, $StatusBarExGraphic
Global $MultiStatusBarEx[0][6] ; $MultiStatusBarEx[1][6] = [["","","","","",""]] ; $hBarEx devient $MultiStatusBarEx ; [["$SethWnd = $hGUI Num","Créé la StatusBar > _GUICtrlStatusBar_Create( $SethWnd)"]]
Global $StatusBarEx_Clock, $ClockStatusBarEx[0][2]
Global $DEBUG_StatusBarEx = '', $DEBUG_StatusBarEx_Sleep = 50 ; For DEBUG
; ===============================================================================================================================
; #FUNCTION#=====================================================================================================================
; Author ........: Anthony Baillou
; Modified.......: Anthony Baillou, walkson, mikell
;
; Name ..........: _GUICtrlStatusBarEx_Create
; Description ...: Ajoute une StatusBar dans le Handle d'une GUI
; Syntax ........: _GUICtrlStatusBarEx_Create( $SethWnd, $SetPartsEx, $SetPartsHeightEx, $SetStartColorEx, $SetEndColorEx)
; Parameters ....: $SethWnd - Handle de la GUI cible.
; $SetPartsEx - [needed] "Pos 1,Pos 2,Pos 3,Pos...". Eg: "100,50,85,240,75,-1"
; $SetPartsHeightEx - [needed] "Height for parts" Eg: 25
; $SetStartColorEx - [optional] "0xRRGGBB". Default is "". Eg: "0xCCAAFF"
; $SetEndColorEx - [optional] "0xRRGGBB". Default is "". Eg: "0xFFAACC"
; ===============================================================================================================================
Func _GUICtrlStatusBarEx_Create( $SethWnd="", $SetPartsEx="", $SetPartsHeightEx="", $SetStartColorEx="", $SetEndColorEx="")
GUISwitch( $SethWnd)
Local $avar[1][6] = [[$SethWnd, _GUICtrlStatusBar_Create( $SethWnd), $SetPartsHeightEx, "", $SetStartColorEx, $SetEndColorEx]]
_ArrayAdd( $MultiStatusBarEx, $avar)
;~ _ArrayDisplay( $MultiStatusBarEx, "2D -> " & @ScriptLineNumber)
;~ ConsoleWrite('Line='&@ScriptLineNumber&", $SethWnd="&$MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][0]&", _GUICtrlStatusBar_Create( $SethWnd)="&$MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][1]&", Count="&UBound($MultiStatusBarEx, 1)&@CRLF)
$PartEx = StringSplit( StringReplace( $SetPartsEx, " ", ""), ",")
Global $hPartsWidthEx[$PartEx[0]], $hPartsPosEx[$PartEx[0]][3]
For $i = 1 To $PartEx[0]
$hPartsWidthEx[$i-1] = $PartEx[$i]
Next
If $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][4] Or $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][5] Then
_WinAPI_SetWindowTheme( $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][1], "", "")
Local $size = WinGetClientSize( $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][0])
_GUICtrlCreateGradient( $SethWnd, $SetStartColorEx, $SetEndColorEx, 0, 0, $size[0], $size[1]-$SetPartsHeightEx)
If $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][5] Then _GUICtrlStatusBar_SetBkColor( $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][1], _WinAPI_SwitchColor( $SetEndColorEx))
EndIf
_GUICtrlStatusBar_SetMinHeight( $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][1], $SetPartsHeightEx)
_GUICtrlStatusBar_SetParts( $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][1],-1, $hPartsWidthEx)
If Not $DEBUG_StatusBarEx = '' Then GUISetState(@SW_SHOW, $SethWnd)
For $i = 0 To $PartEx[0] -1
$hPartsPosEx[$i][0] = GUICtrlCreateButton("This "&$i, -1, -1) ; ID
$hPartsPosEx[$i][1] = GUICtrlGetHandle( $hPartsPosEx[$i][0]) ; Handle
_GUICtrlStatusBar_EmbedControl( $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][1], $i, $hPartsPosEx[$i][1], 4)
Local $var = ControlGetPos( $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][0],"",($hPartsPosEx[$i][0]))
$hPartsPosEx[$i][2] = $var[0]&","&$var[1]&","&$var[2]&","&$var[3]
If Not $DEBUG_StatusBarEx = '' Then Sleep($DEBUG_StatusBarEx_Sleep)
GUICtrlDelete($hPartsPosEx[$i][0])
If Not $DEBUG_StatusBarEx = '' Then Sleep($DEBUG_StatusBarEx_Sleep)
Next
If Not $DEBUG_StatusBarEx = '' Then GUISetState(@SW_HIDE, $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][0])
GUIRegisterMsg($WM_SIZE, "_WM_SIZE")
GUIRegisterMsg($WM_PAINT, "WM_PAINT") ; Same ? > GUIRegisterMsg($WM_ACTIVATEAPP, "_WM_ACTIVATEAPP")
;~ ;GUIRegisterMsg($WM_SYSCOMMAND, "_WM_SYSCOMMAND")
;~ ;GUIRegisterMsg($WM_EXITSIZEMOVE, "_WM_EXITSIZEMOVE")
;~ ;GUIRegisterMsg($WM_ACTIVATEAPP, "_WM_ACTIVATEAPP") ; Same ? > GUIRegisterMsg($WM_PAINT, "WM_PAINT")
Return $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][1] ; Old > Return $SethWnd
EndFunc
; #FUNCTION#=====================================================================================================================
; Author ........: Anthony Baillou, walkson
; Modified.......: Anthony Baillou, walkson, mikell
;
; Name ..........: _GUICtrlStatusBarEx_CreateControl
; Description ...:
; Syntax ........: _GUICtrlStatusBarEx_CreateControl( $hWnd, $IndexControl, $Ex_Part, $Ex_Title, $Ex_X, $Ex_Y, $Ex_W, $Ex_H[, $BkColor = ""[, $SetFont = ""]])
; Parameters ....: $hWnd - Handle de la GUI.
; $IndexControl - Une des valeurs suivantes.
; 1 - Button
; 2 - Checkbox
; 3 - Combobox
; 4 - Date
; 5 - Input
; 6 - Label
; $Ex_Part - N° de section du statusbar.
; $Ex_Title - Texte.
; $Ex_X - X.
; $Ex_Y - Y.
; $Ex_W - Width.
; $Ex_H - Height.
; $Ex_Align - FIXED_LEFT, FIXED_RIGHT, SIZEABLE_LEFT, SIZEABLE_RIGHT ou SIZEABLE_AUTO.
; $BkColor - [optional] RGB. Default is "".
; $SetFont - [optional] "Size|weight|attribute|fontname". Default is "". Eg: "10|$FW_NORMAL|$GUI_FONTNORMAL|Arial"
; Size: eg. 10
; weight: $FW_DONTCARE = 0
; $FW_THIN = 100
; $FW_EXTRALIGHT = 200
; $FW_LIGHT = 300
; $FW_NORMAL = 400
; $FW_MEDIUM = 500
; $FW_SEMIBOLD = 600
; $FW_BOLD = 700
; $FW_EXTRABOLD = 800
; $FW_HEAVY = 900
; attribute : $GUI_FONTNORMAL (0) = Normal
; $GUI_FONTITALIC (2) = Italic
; $GUI_FONTUNDER (4) = Underlined
; $GUI_FONTSTRIKE (8) = Strike
; fontname: eg. Arial
;
; Return values .: Control
; ===============================================================================================================================
Func _GUICtrlStatusBarEx_CreateControl( $hWnd="", $IndexControl="", $Ex_Part="", $Ex_Title="", $Ex_X="", $Ex_Y="", $Ex_W="", $Ex_H="", $Ex_Align="", $Style="", $Ex_Style="", $BkColor="", $SetFont="")
If $IndexControl < 1 Or $IndexControl > 8 Then Return SetError(1)
Local $var = StringSplit( $hPartsPosEx[$Ex_Part][2], ",")
If $Ex_Align = 'FIXED_LEFT' Or $Ex_Align = 'SIZEABLE_LEFT' Then
Local $Bar_Ex_X=$var[1]+$Ex_X, $Bar_Ex_Y=$var[2]+$Ex_Y, $Bar_Ex_W=$Ex_W, $Bar_Ex_H=$var[4]+$Ex_H
ElseIf $Ex_Align = 'FIXED_RIGHT' Or $Ex_Align = 'SIZEABLE_RIGHT' Then
Local $Bar_Ex_X=$var[3]-$Ex_X-$Ex_W+$var[1], $Bar_Ex_Y=$var[2]+$Ex_Y, $Bar_Ex_W=$Ex_W, $Bar_Ex_H=$var[4]+$Ex_H
ElseIf $Ex_Align = 'SIZEABLE_AUTO' Then
Local $Bar_Ex_X=$var[1]+$Ex_X, $Bar_Ex_Y=$var[2]+$Ex_Y, $Bar_Ex_W=$var[3]+$Ex_W-$Ex_X, $Bar_Ex_H=$var[4]+$Ex_H
Else
Local $Bar_Ex_X=$var[1]+$Ex_X, $Bar_Ex_Y=$var[2]+$Ex_Y, $Bar_Ex_W=$var[3]-$Ex_X, $Bar_Ex_H=$var[4]+$Ex_H
EndIf
Switch $IndexControl
Case 1
$id_Ctrl = GUICtrlCreateButton( $Ex_Title, $Bar_Ex_X, $Bar_Ex_Y, $Bar_Ex_W, $Bar_Ex_H, BitOR( $Style, $Ex_Style))
Case 2
$id_Ctrl = GUICtrlCreateCheckbox( $Ex_Title, $Bar_Ex_X, $Bar_Ex_Y, $Bar_Ex_W, $Bar_Ex_H, BitOR( $Style, $Ex_Style))
Case 3
$id_Ctrl = GUICtrlCreateCombo( "" , $Bar_Ex_X, $Bar_Ex_Y, $Bar_Ex_W, $Bar_Ex_H, BitOR( $Style, $Ex_Style))
$Ex_Split = StringSplit( $Ex_Title,"|")
GUICtrlSetData( $id_Ctrl, StringTrimLeft( $Ex_Title, StringLen($Ex_Split[1]&"|")), $Ex_Split[1])
Case 4
$id_Ctrl = GUICtrlCreateDate( $Ex_Title, $Bar_Ex_X, $Bar_Ex_Y, $Bar_Ex_W, $Bar_Ex_H, BitOR( $Style, $Ex_Style))
Case 5
$id_Ctrl = GUICtrlCreateInput( $Ex_Title, $Bar_Ex_X, $Bar_Ex_Y, $Bar_Ex_W, $Bar_Ex_H, BitOR( $Style, $Ex_Style))
Case 6
$id_Ctrl = GUICtrlCreateLabel( $Ex_Title, $Bar_Ex_X, $Bar_Ex_Y, $Bar_Ex_W, $Bar_Ex_H, BitOR( $Style, $Ex_Style))
Case 7
$id_Ctrl = GUICtrlCreateProgress( $Bar_Ex_X, $Bar_Ex_Y, $Bar_Ex_W, $Bar_Ex_H, BitOR( $Style, $Ex_Style))
Case 8
$id_Ctrl = GUICtrlCreateInput( $Ex_Title, $Bar_Ex_X, $Bar_Ex_Y, $Bar_Ex_W, $Bar_Ex_H, BitOR( $Style, $Ex_Style))
$Ex_Split = StringSplit( $Ex_Title,"|")
GUICtrlSetLimit( GUICtrlCreateUpdown( $id_Ctrl), $Ex_Split[2], $Ex_Split[3]) ; $id_Ctrl, 15, 5
GUICtrlSetData( $id_Ctrl, $Ex_Split[1])
EndSwitch
If $BkColor <> "" Then GUICtrlSetBkColor( $id_Ctrl, $BkColor) ; GUICtrlSetBkColor($id_Ctrl, 0x00FF00)
Local $SetFontSplit
If $SetFont <> "" Then
$SetFontSplit = StringSplit( $SetFont,"|")
If Not IsArray( $SetFontSplit) Then Return SetError(1)
If $SetFontSplit[0] = 4 Then GUICtrlSetFont( $id_Ctrl, $SetFontSplit[1],$SetFontSplit[2],$SetFontSplit[3],$SetFontSplit[4])
EndIf
If $Ex_Part = UBOUND( $hPartsPosEx)-1 Then
If $Ex_Align = 'FIXED_LEFT' Then GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM)
If $Ex_Align = 'FIXED_RIGHT' Then GUICtrlSetResizing( -1, $GUI_DOCKSIZE + $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT)
If $Ex_Align = 'SIZEABLE_LEFT' Or $Ex_Align = 'SIZEABLE_RIGHT' Or $Ex_Align = 'SIZEABLE_AUTO' Then GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT)
Else
GUICtrlSetResizing( $id_Ctrl, $GUI_DOCKLEFT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM)
EndIf
For $i = 0 To UBound($MultiStatusBarEx, 1)-1
If $hWnd = $MultiStatusBarEx[$i][0] Then
_WinAPI_SetWindowPos( $MultiStatusBarEx[$i][1], $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)) ; Old > _WinAPI_SetWindowPos($hBarEx, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE))
EndIf
Next
Return $id_Ctrl
EndFunc
; #FUNCTION#=====================================================================================================================
; Author ........: Anthony Baillou
; Modified.......: Anthony Baillou
;
; Name ..........: _GUICtrlStatusBarEx_CreateFunc
; Description ...: Ajoute une fonction à un objet
; Syntax ........: _GUICtrlStatusBarEx_CreateFunc( $id_Ctrl, $IndexControl, $Options)
; Parameters ....: $id_Ctrl - Handle du contrôle.
; $IndexFunc - Index de la fonction.
; $Options - Options de la fonction.
; Clock..........: $id_Ctrl, 1, [$Options]
; [0] = Affiche une date et/ou une heure.
; S'il y a une partie de date, l'afficher comme une date courte.
; S'il y a une partie d'une heure, l'afficher comme une heure longue.
; Si présent, les deux parties sont affichées.
; [1] = Affiche une date en utilisant la date au format long spécifié dans les paramètres régionaux de votre ordinateur.
; [2] = Affiche une date en utilisant la date au format court spécifié dans les paramètres régionaux de votre ordinateur.
; [3] = Affiche une heure en utilisant l'heure au format spécifié dans les paramètres régionaux de votre ordinateur.
; [4] = Affiche une heure en utilisant le format 24 heures (hh:mm).
; [5] = Affiche une heure en utilisant le format 24 heures (hh:mm:ss).
; ===============================================================================================================================
Func _GUICtrlStatusBarEx_CreateFunc( $id_Ctrl="", $IndexFunc="", $Options="")
If $IndexFunc < 1 Or $IndexFunc > 1 Then Return SetError(1)
Switch $IndexFunc
Case 1
Local $avar[1][2] = [[$id_Ctrl, $Options]]
_ArrayAdd( $ClockStatusBarEx, $avar)
_BarEx_Func_CLOCK()
EndSwitch
EndFunc
; #FUNCTION# ====================================================================================================================
; Author ........: mikell
; Modified.......: Anthony Baillou
; ===============================================================================================================================
Func _GUICtrlCreateGradient( $hWnd, $nStartColor, $nEndColor, $nX, $nY, $nWidth, $nHeight)
_WinAPI_SetWindowTheme( $MultiStatusBarEx[UBound($MultiStatusBarEx, 1)-1][1], "", "")
For $i = 0 To UBound($MultiStatusBarEx, 1)-1
If $hWnd = $MultiStatusBarEx[$i][0] And $MultiStatusBarEx[$i][4] Then
Local $color1R = _ColorGetRed($nStartColor)
Local $color1G = _ColorGetGreen($nStartColor)
Local $color1B = _ColorGetBlue($nStartColor)
Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nHeight
Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nHeight
Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nHeight
If $MultiStatusBarEx[$i][3] <> "" Then GUICtrlDelete( $MultiStatusBarEx[$i][3])
$MultiStatusBarEx[$i][3] = GuiCtrlCreateGraphic($nX, $nY, $nWidth, $nHeight, $TCS_BOTTOM)
;~ Sleep(1000)
;~ GUICtrlSetState( $MultiStatusBarEx[$i][3], $GUI_DISABLE)
;~ GUICtrlSetState( $MultiStatusBarEx[$i][3], $TCS_BOTTOM)
For $j = 0 To $nHeight - $nY
$sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$j, $color1G+$nStepG*$j, $color1B+$nStepB*$j)
GUICtrlSetGraphic( $MultiStatusBarEx[$i][3], $GUI_GR_COLOR, $sColor, 0xffffff)
GUICtrlSetGraphic( $MultiStatusBarEx[$i][3], $GUI_GR_MOVE, 0, $j)
GUICtrlSetGraphic( $MultiStatusBarEx[$i][3], $GUI_GR_LINE, $nWidth, $j)
Next
ConsoleWrite( @ScriptLineNumber& _
", i$="&$i& _
", GUI="&$MultiStatusBarEx[$i][0]& _
", Bar="&$MultiStatusBarEx[$i][1]& _
", BarHeight="&$MultiStatusBarEx[$i][2]& _
", ID="&$MultiStatusBarEx[$i][3]& _
", ColorStart="&$MultiStatusBarEx[$i][4]& _
", ColorEnd="&$MultiStatusBarEx[$i][5]& _
", X="&0& _
", Y="&0& _
", W="&$nWidth& _
", H="&$nHeight& @CRLF)
EndIf
Next
EndFunc
; #FUNCTION# ====================================================================================================================
; Author ........: Anthony Baillou
; Modified.......: Anthony Baillou
; ===============================================================================================================================
Func _BarEx_Func_CLOCK()
For $i = 0 To UBound($ClockStatusBarEx, 1)-1
If Not $StatusBarEx_Clock Then
$StatusBarEx_Clock = 1
AdlibRegister( "_BarEx_Func_CLOCK", 1000)
EndIf
GUICtrlSetData( $ClockStatusBarEx[$i][0], _DateTimeFormat( _NowCalc(), $ClockStatusBarEx[$i][1]))
Next
EndFunc
; #FUNCTION# ====================================================================================================================
; Author ........: mikell
; Modified.......: mikell, Anthony Baillou
; ===============================================================================================================================
Func _WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
For $i = 0 To UBound($MultiStatusBarEx, 1)-1
If $hWnd = $MultiStatusBarEx[$i][0] Then
_GUICtrlStatusBar_Resize( $MultiStatusBarEx[$i][1])
Local $size = WinGetClientSize( $MultiStatusBarEx[$i][0])
_GUICtrlCreateGradient( $MultiStatusBarEx[$i][0], $MultiStatusBarEx[$i][4], $MultiStatusBarEx[$i][5], 0, 0, $size[0], $size[1]-$MultiStatusBarEx[$i][2])
ConsoleWrite( @ScriptLineNumber& _
", i$="&$i& _
", GUI="&$MultiStatusBarEx[$i][0]& _
", Bar="&$MultiStatusBarEx[$i][1]& _
", BarHeight="&$MultiStatusBarEx[$i][2]& _
", ID="&$MultiStatusBarEx[$i][3]& _
", ColorStart="&$MultiStatusBarEx[$i][4]& _
", ColorEnd="&$MultiStatusBarEx[$i][5]& _
", X="&0& _
", Y="&0& _
", W="&$size[0]& _
", H="&$size[1]-$MultiStatusBarEx[$i][2]& @CRLF)
EndIf
Next
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
; #FUNCTION# ====================================================================================================================
; Author ........: mikell
; Modified.......: mikell, Anthony Baillou
; ===============================================================================================================================
Func WM_PAINT($hWnd, $msg, $wParam, $lParam)
;~ GUISwitch( $hWnd)
For $i = 0 To UBound($MultiStatusBarEx, 1)-1
If $hWnd = $MultiStatusBarEx[$i][0] Then
;~ ConsoleWrite( 'Line='&@ScriptLineNumber&', '&$hWnd &"="&$MultiStatusBarEx[$i][0]&'>'&$MultiStatusBarEx[$i][1]&@CRLF)
DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $hWnd, "ptr", 0, "int", 0) ; Old > DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $hWnd, "ptr", 0, "int", 0)
_WinAPI_RedrawWindow( $MultiStatusBarEx[$i][1], "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW)) ; Old > _WinAPI_RedrawWindow($hBarEx, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
EndIf
Next
Return $GUI_RUNDEFMSG
EndFunc
; #FUNCTION# ====================================================================================================================
; Author ........: mikell
; Modified.......: mikell
; ===============================================================================================================================
;~ Func _WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)
;~ #forceref $hWnd, $Msg, $lParam
;~ Switch BitAND($wParam, 0xFFF0)
;~ Case 0xF000 ; $SC_SIZE
;~ $exstyle = _WinAPI_GetWindowLong( $hWnd, -20)
;~ _WinAPI_SetWindowLong( $hWnd, -20, 33554432)
;~ EndSwitch
;~ EndFunc
; #FUNCTION# ====================================================================================================================
; Author ........: mikell
; Modified.......: mikell
; ===============================================================================================================================
;~ Func _WM_EXITSIZEMOVE($hWnd, $msg, $wParam, $lParam)
;~ _WinAPI_SetWindowLong( $hWnd, -20, $exstyle )
;~ Return $GUI_RUNDEFMSG
;~ EndFunc
; #FUNCTION# ====================================================================================================================
; Author ........: mikell
; Modified.......: mikell
; ===============================================================================================================================
;~ Func _WM_ACTIVATEAPP($hWnd, $msg, $wParam, $lParam)
;~ If $wParam = 1 Then _WinAPI_RedrawWindow($hBarEx, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
;~ Return $GUI_RUNDEFMSG
;~ EndFunc
La DEMO actuelle
Code : Tout sélectionner
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.5
Author: Anthony Baillou
Modified: Anthony Baillou, walkson, mikell
Date: 24/04/2020, 11h15
Script Function:
<GuiStatusBarEx.au3> (UDF)
#ce ----------------------------------------------------------------------------
#include <GuiStatusBarEx.au3> ; With include <GuiStatusBar.au3>
Local $var1
For $i = 1 To 1000
If $i = 500 Then
$var1 &= 'Combo|'
Else
$var1 &= $i&'|'
EndIf
Next
; == $hGUI_1 ===================================================================
Local $hGUI_1 = GUICreate("<GuiStatusBarEx.au3> (UDF DEMO Parent $hGUI_1)", 1024, 285, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
Local $WinGetPos1, $Pos1
Local $nStartColor_1=0xCCAAAA, $nEndColor_1=0x00f0ff
$hGUI_1_StatusBarEx = _GUICtrlStatusBarEx_Create( $hGUI_1, "100,50,100,85,240,70,75,-1", 60, $nStartColor_1, $nEndColor_1) ; $hGUI_1_StatusBarEx=_GUICtrlStatusBarEx_Create( $hGUI_1, "75,90,100,85,-1", 60) > (Parent Handle 1, "Width,of,Parts,..,-1", StatusBarEx 1 Height, Start color gradient, End color gradient)
$hGUI_1_Label_1 = _GUICtrlStatusBar_SetText($hGUI_1_StatusBarEx, "1", 0) ; Set Standard StatusBar, $Label1
$hGUI_1_Label_2 = _GUICtrlStatusBar_SetText($hGUI_1_StatusBarEx, "2", 1) ; Set Standard StatusBar, $Label2
$hGUI_1_Label_3 = _GUICtrlStatusBar_SetText($hGUI_1_StatusBarEx, "3", 2) ; Set Standard StatusBar, $Label3
$hGUI_1_Label_4 = _GUICtrlStatusBar_SetText($hGUI_1_StatusBarEx, "4", 3) ; Set Standard StatusBar, $Label4
$hGUI_1_Label_5 = _GUICtrlStatusBar_SetText($hGUI_1_StatusBarEx, "5", 4) ; Set Standard StatusBar, $Label5
$hGUI_1_Label_6 = _GUICtrlStatusBar_SetText($hGUI_1_StatusBarEx, "6", 5) ; Set Standard StatusBar, $Label6
$hGUI_1_Label_7 = _GUICtrlStatusBar_SetText($hGUI_1_StatusBarEx, "7", 6) ; Set Standard StatusBar, $Label7
$hGUI_1_Label_8 = _GUICtrlStatusBar_SetText($hGUI_1_StatusBarEx, "8", 7) ; Set Standard StatusBar, $Label8
$hGUI_1_Button_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 1, "1", "Get" , 12, 0, 0, 0, "" , "" , "", 0xFFFF00,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_1_Checkbox_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 2, "2", "Checkbox" , 12, 0, 0, 0, "SIZEABLE_AUTO", "" , "", 0x00FF50,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_1_Combo_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 3, "3", "Combo|"&$var1 , 12, 3, 0, 0, "" , $CBS_DROPDOWN+$WS_VSCROLL , "", 0xFFFF00,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_1_Input_UpDown_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 8, "3", "5|10|0" , 12, 30, 0, -33, "" , "" , "", 0xFFFF00,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_1_Date_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 4, "4", "Date" , 12, 0, 0, 0, "SIZEABLE_AUTO", "" , "", 0xFFFFFF,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_1_Input_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 5, "5", "Input" , 12, 0, 0, 0, "SIZEABLE_AUTO", "" , "", 0xFF9876,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_1_Progress_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 7, "6", "Progress" , 12, 0, 0, 0, "SIZEABLE_AUTO", "" , "", 0xFFFFFF,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_1_Button_2 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 1, "7", "Go" , 12, 0, 25, 0, "FIXED_LEFT" , "" , "", 0xAAFFAA,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_1_Label_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 6, "7", "Label1" , 42, 0, 170, 0, "SIZEABLE_LEFT", $SS_CENTER+$SS_CENTERIMAGE , "", 0xFFAA00,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier New")
$hGUI_1_Label_2 = _GUICtrlStatusBarEx_CreateControl( $hGUI_1, 6, "7", "Label2" , 0, 0, 65, 0, "FIXED_RIGHT" , $SS_CENTER , "", 0xAAAAAA,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
_GUICtrlStatusBarEx_CreateFunc( $hGUI_1_Label_1, 1, 0) ; Clock Option 0
$hGUI_1_Button1 = GUICtrlCreateButton("Show GUI Child with $hGUI_2_StatusBarEx", 100, 80, 800, 50)
GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKSIZE + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT)
; == $hGUI_2 ===================================================================
Local $hGUI_2 = GUICreate("<GuiStatusBarEx.au3> (UDF DEMO Child $hGUI_2)", 900, 150, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
Local $WinGetPos2, $Pos2
Local $nStartColor_2=0x00f0ff, $nEndColor_2=0x00aaaa
$hGUI_2_StatusBarEx = _GUICtrlStatusBarEx_Create( $hGUI_2, "150, 125, 100, 85, 100, -1", 27, $nStartColor_2, $nEndColor_2) ; $hGUI_2_StatusBarEx=_GUICtrlStatusBarEx_Create( $hGUI_2, "150,125,100,85,100,-1", 60) > (Parent Handle 2, "Width,of,Parts,..,-1", StatusBarEx 2 Height, Start color gradient, End color gradient)
$hGUI_2_Button_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_2, 1, "1", "Get" , 0, 0, 0, 0, "" , "" , "", 0xFFFF00,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_2_Checkbox_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_2, 2, "2", "Checkbox" , 0, 0, 0, 0, "SIZEABLE_AUTO", "" , "", 0x00FFF0,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_2_Combo_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_2, 3, "3", "Combo|"&$var1, 0, 0, 0, 10, "SIZEABLE_AUTO", $CBS_DROPDOWN+$WS_VSCROLL , "", 0xFFFF00,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_2_Input_UpDown_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_2, 8, "4", "5|10|0" , 0, 0, 0, 0, "" , "" , "", 0xFFFF00,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_2_Button_2 = _GUICtrlStatusBarEx_CreateControl( $hGUI_2, 1, "5", "Start" , 0, 0, 50, 0, "FIXED_LEFT" , "" , "", 0xAAFFAA,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_2_Progress_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_2, 7, "5", "" , 57, 0, 70, 0, "SIZEABLE_LEFT", "" , "", 0xFFFFFF,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_2_Label_1 = _GUICtrlStatusBarEx_CreateControl( $hGUI_2, 6, "5", "0 %" , 57, 0, 70, 0, "SIZEABLE_LEFT", $SS_CENTER+$SS_CENTERIMAGE , "", $GUI_BKCOLOR_TRANSPARENT,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
$hGUI_2_Label_2 = _GUICtrlStatusBarEx_CreateControl( $hGUI_2, 6, "5", "Label2" , 0, 0, 185, 0, "FIXED_RIGHT" , $SS_CENTER+$SS_CENTERIMAGE , "", 0xAAAAAA,"8.5|$FW_NORMAL|$GUI_FONTNORMAL|Courier new")
_GUICtrlStatusBarEx_CreateFunc( $hGUI_2_Label_2, 1, 3) ; Clock Option 3
; == Show Parent GUI's =========================================================
GUISetState(@SW_SHOW, $hGUI_1)
While 1
$GUIGetMsg = GUIGetMsg(1)
$msg = $GUIGetMsg[0]
Switch $msg
Case $GUI_EVENT_CLOSE
If $GUIGetMsg[1] = $hGUI_1 Then ; From $hGUI_1
Exit
ElseIf $GUIGetMsg[1] = $hGUI_2 Then ; From $hGUI_2
GUISetState(@SW_HIDE, $hGUI_2)
EndIf
; == $hGUI_1 ===================================================================
Case $hGUI_1_Button1 ; From $hGUI_1
GUISetState(@SW_SHOW, $hGUI_2)
Case $hGUI_1_Button_1 ; From $hGUI_1_StatusBarEx
MsgBox("", "Return text of the Button 1", "$hGUI_1_Button_1 return: " & @CRLF&@CRLF & GUICtrlRead( $hGUI_1_Button_1), 5)
Case $hGUI_1_Checkbox_1 ; From $hGUI_1_StatusBarEx
If GUICtrlRead($hGUI_1_Checkbox_1) = $GUI_CHECKED Then
GUICtrlSetData($hGUI_1_Checkbox_1, 'Checked')
Else
GUICtrlSetData($hGUI_1_Checkbox_1, 'Unchecked')
EndIf
Case $hGUI_1_Combo_1 ; From $hGUI_1_StatusBarEx
MsgBox( "", "Return text of the Combo1", "$hGUI_1_Combo_1 return: " & @CRLF&@CRLF & GUICtrlRead( $hGUI_1_Combo_1), 5)
Case $hGUI_1_Input_UpDown_1 ; From $hGUI_1_StatusBarEx
MsgBox( "", "Return text of the Input With UpDown", "$hGUI_1_Input_UpDown_1 return: " & @CRLF&@CRLF & GUICtrlRead( $hGUI_1_Input_UpDown_1), 5)
Case $hGUI_1_Date_1 ; From $hGUI_1_StatusBarEx
MsgBox("", "Return text of the Input", "$Combo1 return: " & @CRLF&@CRLF & GUICtrlRead( $hGUI_1_Date_1), 5)
Case $hGUI_1_Button_2 ; From $hGUI_1_StatusBarEx
For $i = 100 To 1 Step -1
GUICtrlSetData( $hGUI_1_Progress_1, $i)
GUICtrlSetData( $hGUI_1_Input_1, $i & " %")
Sleep(10)
Next
GUICtrlSetData( $hGUI_1_Progress_1, 0)
GUICtrlSetData( $hGUI_1_Input_1, "Done")
; == $hGUI_2 ===================================================================
Case $hGUI_2_Button_1 ; From $hGUI_2_StatusBarEx
MsgBox("", "Return text of the Button 1", "$hGUI_2_Button_1 return: " & @CRLF&@CRLF & GUICtrlRead( $hGUI_2_Button_1), 5)
Case $hGUI_2_Checkbox_1 ; From $hGUI_2_StatusBarEx
If GUICtrlRead($hGUI_2_Checkbox_1) = $GUI_CHECKED Then
GUICtrlSetData($hGUI_2_Checkbox_1, 'Checked')
Else
GUICtrlSetData($hGUI_2_Checkbox_1, 'Unchecked')
EndIf
Case $hGUI_2_Combo_1 ; From $hGUI_2_StatusBarEx
MsgBox( "", "Return text of the Combo1", "$hGUI_2_Combo_1 return: " & @CRLF&@CRLF & GUICtrlRead( $hGUI_2_Combo_1), 5)
Case $hGUI_2_Input_UpDown_1 ; From $hGUI_2_StatusBarEx
MsgBox( "", "Return text of the Input With UpDown", "$hGUI_2_Input_UpDown_1 return: " & @CRLF&@CRLF & GUICtrlRead( $hGUI_2_Input_UpDown_1), 5)
Case $hGUI_2_Button_2 ; From $hGUI_2_StatusBarEx
For $i = 0 To 100 Step 1
GUICtrlSetData( $hGUI_2_Progress_1, $i)
GUICtrlSetData( $hGUI_2_Label_1, $i & " %")
Sleep(50)
Next
GUICtrlSetData( $hGUI_2_Progress_1, 0)
GUICtrlSetData( $hGUI_2_Label_1, "0 %")
EndSwitch
$WinGetPos1 = WinGetPos($hGUI_1) ; From $hGUI_1_StatusBarEx
If $Pos1 <> $WinGetPos1[0]&","&$WinGetPos1[1]&","&$WinGetPos1[2]&","&$WinGetPos1[3] Then
$Pos1 = $WinGetPos1[0]&","&$WinGetPos1[1]&","&$WinGetPos1[2]&","&$WinGetPos1[3]
_GUICtrlStatusBar_SetText( $hGUI_1_StatusBarEx, $Pos1, 0)
EndIf
$WinGetPos2 = WinGetPos($hGUI_2) ; From $hGUI_2_StatusBarEx
If $Pos2 <> $WinGetPos2[0]&","&$WinGetPos2[1]&","&$WinGetPos2[2]&","&$WinGetPos2[3] Then
$Pos2 = $WinGetPos2[0]&","&$WinGetPos2[1]&","&$WinGetPos2[2]&","&$WinGetPos2[3]
_GUICtrlStatusBar_SetText( $hGUI_2_StatusBarEx, $Pos2, 0)
EndIf
WEnd