Sign in to follow this  
Followers 0
sandin

can GuiCtrlCreateProgress() be disabled?

9 posts in this topic




Actually I don't think that you can "Grey it out". It can be hidden but thats about all.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

it's not grayed-out...

But it's disabled:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 361, 142, 193, 125)

$Progress1 = GUICtrlCreateProgress(16, 32, 305, 49)
GUICtrlSetData(-1, 50)
GuiCtrlSetState($Progress1, $GUI_DISABLE)

$iState = WinGetState(GUICtrlGetHandle($Progress1))
ConsoleWrite("Is Disabled: " & Not BitAND($iState, 4) & @CRLF)

GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSEoÝ÷ Ù:,zÛayÊ%¢»¬zØb±«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑÍà¹ÔÌÐì(¥¹±Õ±ÐíAɽÉÍÍ
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±Ðí]¥¹½ÝÍ
½¹ÍѹÑ̹ÔÌÐì((ÀÌØí½É´ÄôU%
ÉÑ ÅÕ½Ðí½É´ÄÅÕ½Ðì°ÌØÄ°ÄÐÈ°ÄäÌ°ÄÈÔ¤((ÀÌØíAɽÉÍÌÄôU%
Ñɱ
ÉÑAɽÉÍÌ ÄØ°ÌÈ°ÌÀÔ°Ðä¤)U%
ÑɱMÑÑ ´Ä°ÔÀ¤)}U%
ÑɱAɽÉÍÍ}Mѥͱ ´Ä°Ä¤()U%MÑMÑÑ¡M]}M!=¤()¼)U¹Ñ¥°U%Ñ5Í ¤ôÀÌØíU%}Y9Q}
1=M()Õ¹}U%
ÑɱAɽÉÍÍ}Mѥͱ ÀÌØí¹AɽÉÍÍ%°ÀÌØí¥¥Í±ôĤ(%%9½Ð%Í!]¹ ÀÌØí¹AɽÉÍÍ%¤Q¡¸ÀÌØí¹AɽÉÍÍ%ôU%
ÑɱÑ!¹± ÀÌØí¹AɽÉÍÍ%¤($(%%ÀÌØí¥¥Í±Q¡¸($%±±
±° ÅÕ½ÐíUáQ¡µ¹±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMÑ]¥¹½ÝQ¡µÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÀÌØí¹AɽÉÍÍ%°ÅÕ½ÐíÝÍÑÈÅÕ½Ðì°À°ÅÕ½ÐíÝÍÑÈÅÕ½Ðì°À¤($$($%U%
ÑɱMÑMÑÑ ÀÌØí¹AɽÉÍÍ%°ÀÌØíU%}%M    1¤($%U%
ÑɱMÑ
½±½È ´Ä°ÁáÁÁÀ¤(%±Í($%±±
±° ÅÕ½ÐíUáQ¡µ¹±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMÑ]¥¹½ÝQ¡µÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÀÌØí¹AɽÉÍÍ%°ÅÕ½ÐíÝÍÑÈÅÕ½Ðì°´Ä°ÅÕ½ÐíÝÍÑÈÅÕ½Ðì°À¤($$($%U%
ÑɱMÑMÑÑ ÀÌØí¹AɽÉÍÍ%°ÀÌØíU%}9 1¤($%U%
ÑɱMÑ
½±½È ´Ä°ÁàÀÁÀÀ¤(%¹%)¹Õ¹

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Use other parameters for setWindowTheme :)

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

$Form1 = GUICreate("Form1", 361, 142, 193, 125)

$Progress1 = GUICtrlCreateProgress(16, 32, 305, 49)
GUICtrlSetData(-1, 50)

GUISetState(@SW_SHOW)

Sleep(1000)
_GUICtrlProgress_SetDisabled(-1, 1)
Sleep(1000)
_GUICtrlProgress_SetDisabled(-1, 0)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _GUICtrlProgress_SetDisabled($nProgressID, $iDisable=1)
    Local $hProgress = GUICtrlGetHandle($nProgressID)
    
    If $iDisable Then
        DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hProgress, "ptr", 0, "wstr", "")
       
        GUICtrlSetState($nProgressID, $GUI_DISABLE)
        GUICtrlSetColor($nProgressID, 0xC0C0C0)
    Else
        DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hProgress, "ptr", 0, "ptr", 0)
       
        GUICtrlSetState($nProgressID, $GUI_ENABLE)      
        GUICtrlSetColor($nProgressID, 0x00FF00)
    EndIf
EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Use other parameters for setWindowTheme

Thanks, i also tried to make it work, but without success.

Here is a full example of the _GUICtrlProgressBar_SetDisabled() function:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
;

$hGUI = GUICreate("_GUICtrlProgressBar_SetDisabled Example", 360, 140, 200, 120)

$Progress = GUICtrlCreateProgress(20, 30, 320, 50)
GUICtrlSetData(-1, 50)

$Disable_Button = GUICtrlCreateButton("Disable ProgressBar", (360 / 2) - (120 / 2), 100, 120, 20)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Disable_Button
            If BitAND(WinGetState(GUICtrlGetHandle($Progress)), 4) Then
                GUICtrlSetData($Disable_Button, "Enable ProgressBar")
                _GUICtrlProgressBar_SetDisabled($Progress, 1)
            Else
                GUICtrlSetData($Disable_Button, "Disable ProgressBar")
                _GUICtrlProgressBar_SetDisabled($Progress, 0)
            EndIf
    EndSwitch
WEnd

Func _GUICtrlProgressBar_SetDisabled($nProgressID, $iDisable=1)
    Local $hProgress = GUICtrlGetHandle($nProgressID)
    If IsHWnd($nProgressID) Then $hProgress = $nProgressID
    
    If $iDisable Then
        DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hProgress, "ptr", 0, "wstr", "")
        
        Local $iOld_Progress = GUICtrlRead($nProgressID)
        
        GUICtrlSetStyle($nProgressID, BitOr($GUI_SS_DEFAULT_PROGRESS, $PBS_SMOOTH))
        GUICtrlSetData($nProgressID, $iOld_Progress)
        GUICtrlSetState($nProgressID, $GUI_DISABLE)
        GUICtrlSetColor($nProgressID, 0xC0C0C0)
        GUICtrlSetBkColor($nProgressID, 0xEBEBEB)
    Else
        DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hProgress, "ptr", 0, "ptr", 0)
        GUICtrlSetState($nProgressID, $GUI_ENABLE)
    EndIf
EndFunc

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0