Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#45 closed Bug (Wont Fix)

Resizing GUI after _GUICtrlStatusBar_EmbedControl (Marquee Progress bar)

Reported by: big_daddy 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 Changed 16 years ago by Gary

  • Owner set to Gary
  • priority changed from major to minor
  • Status changed from new to assigned

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

comment:2 Changed 16 years ago by Gary

  • Component changed from AutoIt to Standard UDFs

comment:3 Changed 16 years ago by Gary

I see where the bar(s) disappear, but still don't get a hard crash.

WinXP Pro SP2

comment:4 Changed 16 years ago by Gary

  • Resolution set to worksforme
  • Status changed from assigned to 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 Changed 16 years ago by big_daddy

  • Resolution worksforme deleted
  • Status changed from closed to 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:6 Changed 16 years ago by Gary

Another DEV will have to verify, I can't make it crash.

comment:7 Changed 16 years ago by big_daddy <robert.i.anthony@…>

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 Changed 16 years ago by anonymous

I get a hard crash too when locking the right bottom corner dragging outwards...

comment:9 Changed 16 years ago by JdeB

That was me :)

comment:10 Changed 16 years ago by Gary

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 Changed 16 years ago by Gary

  • Component changed from Standard UDFs to AutoIt
  • Summary changed from Resizing GUI after _GUICtrlStatusBar_EmbedControl to Resizing GUI after _GUICtrlStatusBar_EmbedControl (Marquee Progress bar)

comment:12 Changed 16 years ago by Gary

  • Owner Gary deleted
  • Status changed from reopened to assigned

comment:13 follow-up: Changed 16 years ago by Gary

  • Owner set to Gary

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 Changed 16 years ago by Gary

  • Resolution set to wontfix
  • Status changed from assigned to closed

comment:15 Changed 16 years ago by Gary

  • Component changed from AutoIt to Other

comment:16 in reply to: ↑ 13 Changed 16 years ago by anonymous

@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

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Gary.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.