#45 closed Bug (Wont Fix)
Resizing GUI after _GUICtrlStatusBar_EmbedControl (Marquee Progress bar)
| Reported by: | Bob Anthony | Owned by: | Gary |
|---|---|---|---|
| Milestone: | Component: | Other | |
| Version: | 3.2.10.0 | Severity: | |
| Keywords: | Windows XP SP2 | Cc: |
Description
The progress bar disappears when you try to resize the gui in the following example. I've tried in a larger example to resize the status bar and re-embed the control after the WM_SIZE message with the same results.
If you enable the commented code and resize the gui it will hard crash AutoIt.
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
_Main()
Func _Main()
Local $hGUI, $hProgress, $hInput, $input, $progress, $hStatus
Local $aParts[4] = [80, 160, 300, -1]
; Create GUI
$hGUI = GUICreate("StatusBar Embed Control", 400, 300)
GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
$hStatus = _GUICtrlStatusBar_Create($hGUI)
_GUICtrlStatusBar_SetMinHeight($hStatus, 20)
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
_GUICtrlStatusBar_SetText($hStatus, "Part 1")
_GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)
; Embed a progress bar
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
; *** Warning *** Resizing the window with the following enabled will hard crash AutoIt.
;~ $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE)
;~ $hProgress = GUICtrlGetHandle($progress)
;~ _GUICtrlStatusBar_EmbedControl ($hStatus, 3, $hProgress)
;~ _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200)
GUISetState()
EndFunc ;==>_Main
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Attachments (0)
Change History (16)
comment:1 by , 18 years ago
| Owner: | set to |
|---|---|
| priority: | major → minor |
| Status: | new → assigned |
comment:2 by , 18 years ago
| Component: | AutoIt → Standard UDFs |
|---|
comment:3 by , 18 years ago
I see where the bar(s) disappear, but still don't get a hard crash.
WinXP Pro SP2
comment:4 by , 18 years ago
| Resolution: | → worksforme |
|---|---|
| Status: | assigned → closed |
I think the resize needs to be handled by the person writing the script.
This works for me.
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
Global $hStatus, $hProgress, $hProgress2
_Main()
Func _Main()
Local $hGUI, $hInput, $input, $progress
Local $aParts[4] = [80, 160, 300, -1]
; Create GUI
$hGUI = GUICreate("StatusBar Embed Control", 400, 300)
GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
$hStatus = _GUICtrlStatusBar_Create($hGUI)
_GUICtrlStatusBar_SetMinHeight($hStatus, 20)
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
_GUICtrlStatusBar_SetText($hStatus, "Part 1")
_GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)
; Embed a progress bar
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
;~ ; *** Warning *** Resizing the window with the following enabled will hard crash AutoIt.
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE)
$hProgress2 = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl($hStatus, 3, $hProgress2)
_SendMessage($hProgress2, $PBM_SETMARQUEE, True, 200)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
; Resize the status bar when GUI size changes
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
_GUICtrlStatusBar_Resize($hStatus)
_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
_GUICtrlStatusBar_EmbedControl($hStatus, 3, $hProgress2)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
comment:5 by , 18 years ago
| Resolution: | worksforme |
|---|---|
| Status: | closed → reopened |
As I've stated, I attempted to control the resizing using the WM_SIZE message with the same results. The code you provided hard crashes AutoIt when the window is resized using the size box. This has been verified on multiple computers.
comment:7 by , 18 years ago
Does any of this information help?
AppName: test.exe AppVer: 3.2.10.0 ModName: comctl32.dll
ModVer: 6.0.2900.2982 Offset: 00034a9c
comment:8 by , 18 years ago
I get a hard crash too when locking the right bottom corner dragging outwards...
comment:10 by , 18 years ago
Ok, I figured out how to make it crash quick with the Marquee, size towards upper left or just left, making the marquee box shrink till the left and right sides meet it will crash, this is a drawing problem with the marquee I believe.
comment:11 by , 18 years ago
| Component: | Standard UDFs → AutoIt |
|---|---|
| Summary: | Resizing GUI after _GUICtrlStatusBar_EmbedControl → Resizing GUI after _GUICtrlStatusBar_EmbedControl (Marquee Progress bar) |
comment:12 by , 18 years ago
| Owner: | removed |
|---|---|
| Status: | reopened → assigned |
follow-up: 16 comment:13 by , 18 years ago
| Owner: | set to |
|---|
I would have to say it's a windows bug that if the marquee gets small enough it crashes.
This can be avoided:
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
Global $hStatus, $hProgress, $hProgress2, $hGUI
_Main()
Func _Main()
Local $hInput, $input, $progress
Local $aParts[4] = [80, 160, 300, -1]
; Create GUI
$hGUI = GUICreate("StatusBar Embed Control", 400, 300)
GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
$hStatus = _GUICtrlStatusBar_Create($hGUI)
_GUICtrlStatusBar_SetMinHeight($hStatus, 20)
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
_GUICtrlStatusBar_SetText($hStatus, "Part 1")
_GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)
; Embed a progress bar
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
;~ ; *** Warning *** Resizing the window with the following enabled will hard crash AutoIt.
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE)
$hProgress2 = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl($hStatus, 3, $hProgress2)
_SendMessage($hProgress2, $PBM_SETMARQUEE, True, 200)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
; Resize the status bar when GUI size changes
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
_GUICtrlStatusBar_Resize($hStatus)
_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
Local $aRect = _GUICtrlStatusBar_GetRect($hStatus, 3)
ConsoleWrite($aRect[2] - $aRect[0] & @LF)
If $aRect[2] - $aRect[0] <= 10 Then
_WinAPI_SetParent($hProgress2, $hGUI)
GUICtrlSetPos($hProgress2, -100, -100) ; hide the marquee off the window until the status bar part is big enough to hold it.
ElseIf $aRect[2] - $aRect[0] > 10 Then
_GUICtrlStatusBar_EmbedControl($hStatus, 3, $hProgress2)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
comment:14 by , 18 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | assigned → closed |
comment:15 by , 18 years ago
| Component: | AutoIt → Other |
|---|
comment:16 by , 17 years ago
@Gary, I don't about your machine, but the code you posted didn't fix anything, I don't even have to resize the control, it crashes immediately for me. I commented out that part and left the in the smooth progress bar and it doesn't display.
I am running Windows XP Professional SP2.
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
Global $hStatus, $hProgress, $hProgress2, $hGUI
_Main()
Func _Main()
Local $hInput, $input, $progress
Local $aParts[4] = [80, 160, 300, -1]
; Create GUI
$hGUI = GUICreate("StatusBar Embed Control", 400, 300)
GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
$hStatus = _GUICtrlStatusBar_Create($hGUI)
_GUICtrlStatusBar_SetMinHeight($hStatus, 20)
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
_GUICtrlStatusBar_SetText($hStatus, "Part 1")
_GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)
; Embed a progress bar
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
;~ ; *** Warning *** Resizing the window with the following enabled will hard crash AutoIt.
;~ $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE)
;~ $hProgress2 = GUICtrlGetHandle($progress)
;~ _GUICtrlStatusBar_EmbedControl($hStatus, 3, $hProgress2)
;~ _SendMessage($hProgress2, $PBM_SETMARQUEE, True, 200)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
; Resize the status bar when GUI size changes
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
_GUICtrlStatusBar_Resize($hStatus)
;~ _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
;~ Local $aRect = _GUICtrlStatusBar_GetRect($hStatus, 3)
;~ ConsoleWrite($aRect[2] - $aRect[0] & @LF)
;~ If $aRect[2] - $aRect[0] <= 10 Then
;~ _WinAPI_SetParent($hProgress2, $hGUI)
;~ GUICtrlSetPos($hProgress2, -100, -100) ; hide the marquee off the window until the status bar part is big enough to hold it.
;~ ElseIf $aRect[2] - $aRect[0] > 10 Then
;~ _GUICtrlStatusBar_EmbedControl($hStatus, 3, $hProgress2)
;~ EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE

I don't get a hard crash, although the marquee isn't repainted the bar is still there also