cupcake 0 Posted September 12, 2011 (edited) Hi, after I changed a buttons color, I want to restore the initial style (3D, Windows-grey). Here is the code, the button is supposed to be blinking: GUICtrlSetBkColor($buttoncontrol, 0xff00) ;green Sleep($2000) GUICtrlSetBkColor($buttoncontrol, ??? ) ;back to normal Sleep($2000) GUICtrlSetBkColor($buttoncontrol, 0xff00) ;green What I did in the past was this: GUICtrlDelete($buttoncontrol) $buttoncontrol = GUICtrlCreateButton("", 125, 260, 100, 30) GUICtrlSetState($buttoncontrol, $GUI_SHOW) But this seems to be a weird work around. I hope there is a better way Thanks for your help. Edited September 12, 2011 by cupcake Share this post Link to post Share on other sites
UEZ 1,274 Posted September 12, 2011 (edited) Try this: #include <Constants.au3> #include <GUIConstantsEx.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> $hGUI = GUICreate("Test", 245, 151, 192, 124) $Button = GUICtrlCreateButton("Reset Color", 37, 23, 171, 105) $hButton = GUICtrlGetHandle($Button) $Button_Style = _WinAPI_GetWindowLong($hButton, $GWL_STYLE) $Button_ExStyle = _WinAPI_GetWindowLong($hButton, $GWL_EXSTYLE) $Button_DefColor = _WinAPI_GetSysColor($COLOR_BTNFACE) GUISetState(@SW_SHOW) GUICtrlSetBkColor($Button, 0xA0F0A0) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button GUICtrlSetBkColor($Button, $Button_DefColor) _WinAPI_SetWindowLong($hButton, $GWL_STYLE, $Button_Style) _WinAPI_SetWindowLong($hButton, $GWL_EXSTYLE, $Button_ExStyle) _WinAPI_RedrawWindow($hButton) EndSwitch WEnd Br, UEZ Edited September 12, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
cupcake 0 Posted September 12, 2011 (edited) Hey, thank you for the quick reply. This looks better and more sophisticated. Kind regards. Edited September 12, 2011 by cupcake Share this post Link to post Share on other sites
KaFu 295 Posted September 13, 2011 Or something like this ? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("My GUI") $c_Button = GUICtrlCreateButton("Button", 10, 10, 100, 30) GUICtrlSetBkColor($c_Button, 0xff00) GUISetState(@SW_SHOW) Sleep(2000) GUICtrlSetStyle($c_Button, $GUI_SS_DEFAULT_BUTTON) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() OS: Win10-1909 - 64bit - German, AutoIt Version: 3.3.14.5, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2019-Dec-21) BIC - Batch-Image-Cropper (2019-Dec-11) COP - Color Picker (2009-May-21) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2019-Dec-07) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Share this post Link to post Share on other sites