[R] GUI non déplaçable
Posté : mer. 03 déc. 2014 13:40
par Hugues
Bonjour,
Je n'arrive pas à bloquer mon GUI qui est affiché en plein écran grace à la fonction:
J'ai trouvé la fonction Func WM_WINDOWPOSCHANGING($hWnd, $iMsg, $wParam, $lParam)
pour empêcher le GUI de ne pas bouger mais ça ne fonctionne pas avec le WinSetState... Lorsque j'essai de bouger mon GUI avec la barre de titre, le GUI se redimensionne avec la valeur de défaut qu'il a été créé...
Ci joint mon code.
Je n'arrive pas à bloquer mon GUI qui est affiché en plein écran grace à la fonction:
Code : Tout sélectionner
WinSetState($MainGUI, "", @SW_MAXIMIZE)
pour empêcher le GUI de ne pas bouger mais ça ne fonctionne pas avec le WinSetState... Lorsque j'essai de bouger mon GUI avec la barre de titre, le GUI se redimensionne avec la valeur de défaut qu'il a été créé...
Ci joint mon code.
► Afficher le texte
Code : Tout sélectionner
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=favicon.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;==[ Création ]========: xx/xx/2014
;==[ Auteur ]==========:
;==[ Service ]=========:
;==[ Description ]=====:
;==[ Modification ]====: Dernière modification le xx/xx/20xx
;==[ Nature modification ]====:
;==[xx/xx/20xx: ***********************************]========
;==[Includes]===================================================
#include <File.au3>
#include <Date.au3>
#include <GuiStatusBar.au3>
#include <Timers.au3>
#include <Date.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <GuiListView.au3>
#include <StructureConstants.au3>
Opt("GUIOnEventMode", 1)
$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work
;==[Variables globales & autres]================================
Global $CSVFolder = @ScriptDir & "\csv\"
Global $MainGUI, $ChildGUI, $FileToOpen, $aArrayOfMyFile
Global $hStatus, $aParts[3] = [200, 450, 200], $aGuiPos, $WorkAera
Global $x, $y, $w, $h
Global $ApplicationName = "Modèle vierge", $Version = "Demo", $Author = "DocteurX"
;==[Programme]==================================================
_BuildMainGUI()
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_TIMER, "WM_TIMER")
$iTimer = _Timer_SetTimer($MainGUI, 1000)
While GUIGetMsg() <> -3
WEnd
Func _BuildMainGUI()
$MainGUI = GUICreate($ApplicationName & " Powered By " & $Author & ". Version: " & $Version, 437, 185, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $MainGUI)
WinSetState($MainGUI, "", @SW_MAXIMIZE)
$hStatus = _GUICtrlStatusBar_Create($MainGUI, -1, "", $SBARS_SIZEGRIP)
GUIRegisterMsg($WM_WINDOWPOSCHANGING, 'WM_WINDOWPOSCHANGING')
GUISetState(@SW_SHOW)
;==[StatusBar]==============================
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hStatus, "wstr", 0, "wstr", 0)
$hIcons = _WinAPI_LoadShell32Icon(265); 233 -> Icon ATTENTION,
_GUICtrlStatusBar_SetIcon($hStatus, 0, $hIcons)
$hIcons2 = _WinAPI_LoadShell32Icon(160); 233 -> Icon ATTENTION,
_GUICtrlStatusBar_SetIcon($hStatus, 1, $hIcons2)
_GUICtrlStatusBar_SetText($hStatus, "Utilisateur: " & StringUpper(@UserName) & " " & "Poste: " & @ComputerName, 1)
$size = WinGetClientSize($aGuiPos) ;Etait $size = WinGetClientSize(hGUI)
GUISetState(@SW_SHOW)
EndFunc
Func _Exit()
Exit
EndFunc
Func WM_TIMER($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $ilParam
Switch _Timer_GetTimerID($iwParam)
Case $iTimer
_UpdateStatusBarClock()
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_TIMER
Func _UpdateStatusBarClock()
_GUICtrlStatusBar_SetText($hStatus, @TAB & StringFormat(_NowDate() & " " & "%02d:%02d:%02d", @HOUR, @MIN, @SEC), 0)
EndFunc
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam, $ilParam
_GUICtrlStatusBar_Resize($hStatus)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
Func WM_WINDOWPOSCHANGING($hWnd, $iMsg, $wParam, $lParam)
#forceref $iMsg, $wParam, $lParam
Local $aWinGetPos = WinGetPos($hWnd)
If @error Or $aWinGetPos[0] < -30000 Then Return $GUI_RUNDEFMSG
Local $tWindowPos = DllStructCreate($tagWINDOWPOS, $lParam)
DllStructSetData($tWindowPos, 'X', $aWinGetPos[0])
DllStructSetData($tWindowPos, 'Y', $aWinGetPos[1])
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_WINDOWPOSCHANGING