Opened 15 years ago

Closed 15 years ago

#1077 closed Bug (Fixed)

GUICtrlSetBkColor excessive recoloring == faulty coloring, and strange WinGUI behavior

Reported by: Mulder Owned by: Jpm
Milestone: Component: AutoIt
Version: Severity: None
Keywords: GUICtrlSetBkColor Cc:

Description (last modified by Valik)

Tested on Win2000 and XP
On XP its just wrong coloring
on Win2000 coloring in the Autoit GUI is wrong and the WinGUI (explorer.exe) behavior is very strange.
Parts of background windows show up other on top windows are hidden ...

This bug started after v3.2.0.1 and v3.2.10.0
On v3.2.0.1 you can run the script and everthing is fine
After v3.2.10.0 you can run the script and everthing is fine except that some strange black lines are rendered during recoloring
After v3.2.12.0-rc4 and ~12000 loops you run into the described problem

I tried to make a screenshot of it
but when the AutoitGUI run in this problem
and i press the print-button i recive a "out of memory" error
I own 4Gig ram (only 3.n GB free)
Process explorer don't show heavy ram usage!

What am i doing
I repaint the backgroundcolor of an edit field
normaly every 250ms in this test without any sleep
to realize a color gradient effect over time

I've attached the script
it seems that there are some problems with char caret

Opt("GUIOnEventMode", 1)

;#include <GUIConstantsEX.au3>
;#include <EditConstants.au3>
#include <Constants.au3>
#include <GUIConstants.au3>

Global $GUIheight	=	520
Global $GUIwidth	=	515
Global $GUIcurHEIGHT	=	10

Global $mainwindow      =	GUICreate("UfoAI win32 buildscript",$GUIheight,$GUIheight)
;				GUISetBkColor( 0x000000, $mainwindow )
;				GUICtrlSetDefColor( 0xC0C0C0, $mainwindow )
				GUISetOnEvent( $GUI_EVENT_CLOSE,	"MainWindow" )

Global $Input    	    =	GUICtrlCreateInput( "",		10,	$GUIcurHEIGHT,	$GUIwidth-75,	20 )

				Local $counter, $rand1, $rand2, $color[3]=[255,00,00]

				while 1
;					if $counter > 12200 then Sleep(100)
					GUICtrlSetData( $Input, $counter, "" )
;					sleep(1)
					if $color[$rand2] = $rand1 then
						$rand1 = Random( 1, 255, 1 )
						$rand2 = Random( 0, 2, 1 )
						if $rand1 < $color[$rand2] then
							$color[$rand2] -= 1
							$color[$rand2] += 1
;					GUICtrlSetBkColor( $Input, $color[0]*2^16 + $color[1]*2^8 + $color[2] )
					Color( $Input, $color[0]*2^16 + $color[1]*2^8 + $color[2] )
Func MainWindow()
	If @GUI_WINHANDLE = $mainwindow Then

Func color($var1,$var2)
	GUICtrlSetBkColor( $var1, $var2 )

Attachments (1)

Neu Textdatei.txt (1.3 KB) - added by Mulder 15 years ago.
The script as a txt file

Download all attachments as: .zip

Change History (4)

Changed 15 years ago by Mulder

The script as a txt file

comment:1 Changed 15 years ago by Valik

  • Description modified (diff)

comment:2 Changed 15 years ago by Valik

An obvious (and confirmed) GDI handle leak.

comment:3 Changed 15 years ago by Jpm

  • Milestone set to
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed in version:

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

as closed The owner will remain Jpm.

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

Note: See TracTickets for help on using tickets.