Sign in to follow this  
Followers 0
zeevid

Disable/Enable Minimize Function

6 posts in this topic

I found that when processing a ListView, if the window is minimized, the _GUICtrlListViewGetItemText function does not return the row of data and the script crashes when you try to interegate the data.

I want to be able to turn off the screen's ability to minimize during this process, and then turn the minimize ability back on.

I tried to add a "Case $Msg = $GUI_EVENT_MINIMIZE" to the control loop, but the fact is that the screen minimizes before this case is identified (and the script crashes).

Is there a call, function, etc. that I can use to tell the window to not allow Minimize, and then later tell the window to allow minimize?

Thank you.

Share this post


Link to post
Share on other sites



maybe this will work??

#include <GUIConstants.au3>

$win = GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered

Opt("GUICoordMode",2)
$btn1 = GUICtrlCreateButton ("test",  10, 30, 50)
$btn2 = GUICtrlCreateButton ( "Cancel",  0, -1)

GUISetState ()    ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $btn1 Then
        GUISetState( @SW_DISABLE, $win)
    ; do your function
        Sleep(5000)
        GUISetState( @SW_ENABLE, $win)
    EndIf
    
    If $msg = $GUI_EVENT_CLOSE Or $msg = $btn2 Then ExitLoop
Wend

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

You could always build the GUI without a title bar. See example below

#include <GuiConstants.au3>
GuiCreate("My test GUI", 400, 78,(@DesktopWidth-400)/2, (@DesktopHeight-78)/2, $WS_POPUP + $WS_DLGFRAME)
GuiSetState()
$Button = GuiCtrlCreateButton("OK", 340, 20, 50, 30)
$Label = GuiCtrlCreateLabel("Here is some text", 20, 20, 300, 40)
GUICtrlSetFont($Label, 24)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
       Case $msg = $Button
        ExitLoop
    EndSelect
WEnd


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$win_state = WinGetState("You window title')
    If BitAND($win_state, 8) And BitAND($win_state, 2) Then
; do something here

    EndIf

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thank you everyone for you quick replies.

Unfortunately, I've found that the bug with the _GUICtrlListViewGetItemText function that I thought only occured when the window is minimized happens when the window is not "on top". I'm trying to use the WinSetOnTop function to make sure that the window is Disabled and OnTop while the function runs.

Hopefully this will work.

Thanks again.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thank you everyone for you quick replies.

Unfortunately, I've found that the bug with the _GUICtrlListViewGetItemText function that I thought only occured when the window is minimized happens when the window is not "on top". I'm trying to use the WinSetOnTop function to make sure that the window is Disabled and OnTop while the function runs.

Hopefully this will work.

Thanks again.

_GUICtrlListViewGetItemText utilizes the ControlListView function

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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