Jump to content

GUI @SW_HIDE without visual effects - how?


Go to solution Solved by Yashied,

Recommended Posts

Posted

whenever i call this on my GUI:

GUISetState(@SW_HIDE)

the GUI does indeed become hidden, but it does so with a visual effect used for the Minimize command - i.e. decreasing size while fading. the effect is very swift, but still i'd like to cancel this effect and make the GUI immediately hidden.

any hints?

Signature - my forum contributions:

  Reveal hidden contents

 

Posted
  On 3/4/2015 at 10:17 AM, TheDcoder said:

 

nope. it doesn't work in practice, and no reason it should work in theory either.

Signature - my forum contributions:

  Reveal hidden contents

 

Posted

Func _WinHide($hWin, $toggled = False)
    If $toggled = False Then
        GUISetState(@SW_DISABLE, $hWin)
        GUISetState(@SW_HIDE, $hWin)
    Else
        GUISetState(@SW_ENABLE, $hWin)
        GUISetState(@SW_SHOW, $hWin)
    EndIf
EndFunc ; TheDcoder ;)

:)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted

tried that. disabling before hiding makes no difference.

Signature - my forum contributions:

  Reveal hidden contents

 

Posted

I can't say I've ever noticed this issue.

Perhaps it is a Windows setting on your PC?

I seem to recall you can have that occur.

I don't have that enabled on mine.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

  Reveal hidden contents

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Posted
  On 3/4/2015 at 10:46 AM, TheDcoder said:

Strange.... Works for me

 

if you omit the disable/enable, do you see the effect that you claim not to see when the disable/enable in place?

 

  On 3/4/2015 at 10:57 AM, TheSaint said:

Perhaps it is a Windows setting on your PC?

 

it is, it's part of the Aero effects. the point is - i don't want it disabled, not in general and not for this application. i simply want this specific GUI of my script to just hide itself when i ask it to.

Signature - my forum contributions:

  Reveal hidden contents

 

Posted
  On 3/4/2015 at 11:16 AM, TheDcoder said:

no

 

so if either way you do not see the effect, it means disable/enable does not make any difference. b.t.w it is set here::

System Properties > Advanced > Performance > Settings...

Visual Effects > "Animate windows when minimizing and maximizing"

Signature - my forum contributions:

  Reveal hidden contents

 

Posted
  On 3/4/2015 at 11:22 AM, orbs said:
System Properties > Advanced > Performance > Settings...

Visual Effects > "Animate windows when minimizing and maximizing"

So if you change that setting, do you still get your issue?

If no, then you need to look at something that will either temporarily unset that setting, or you need to do research outside of AutoIt I expect, for it would be a Windows issue, not an AutoIt one. That's not to say that some DLL call etc might not do the trick.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

  Reveal hidden contents

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Posted (edited)

Try this:

Func EnableWindowAnimation($value = True)

Local Const $SPI_SETANIMATION = 0x0049
Local Const $SPI_GETANIMATION = 0x0048
Local Const $tagANIMATIONINFO = "uint cbSize;int iMinAnimate"

Local $struct = DllStructCreate($tagANIMATIONINFO)
DllStructSetData($struct, "iMinAnimate", $value)
DllStructSetData($struct, "cbSize", DllStructGetSize($struct))

$aReturn = DllCall('user32.dll', 'int', 'SystemParametersInfo', 'uint', $SPI_SETANIMATION, 'int', DllStructGetSize($struct), _
   'ptr', DllStructGetPtr($struct), 'uint', 0)

EndFunc   ;==>_wndMinAnimation

Call that function with a False argument and then do the GUISetState(@SW_HIDE) . Just dont forget to enable the animation back by calling the Function with the True argument. 

Best bet is to put it on gui close event:

Case $GUI_EVENT_CLOSE
                    EnableWindowAnimation(True)

Though to be honest I've never experienced this issue might be some funky windows settings on your machine....

Edited by mpower
  • Solution
Posted

$hForm = GUICreate('MyGUI', 400, 400)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case -3
            WinSetTrans($hForm, '', 0)
            GUISetState(@SW_HIDE)
            ExitLoop
    EndSwitch
WEnd

Sleep(1000)

Posted
  On 3/5/2015 at 11:47 AM, Yashied said:
WinSetTrans($hForm, '', 0)

 

someday i'll make it to the level i'll feel ashamed for not thinking about it myself... a simple and elegant workaround! thanks Yashid!  :thumbsup:

Signature - my forum contributions:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...