Sign in to follow this  
Followers 0
spudw2k

Faded Menubar color after WinActivate and AnimateWindow

5 posts in this topic

I found a strange behavior that I wanted to share.  The script below demonstrates the issue.  I set $GUI_EVENT_CLOSE to hide the GUI instead of closing it.  After hiding for 3 seconds it will restore.  Notice the Menubar is slightly dimmed.  I noticed if you activate another open window and re-activate the script GUI it restores the menubar to the normal darker color. 

#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>

Opt("GUIOnEventMode", 1)

Local $hGUI = GUICreate("Test GUI w/ Menu", 300, 200)
Local $idMenu = GUICtrlCreateMenu("Menu")
Local $idMenuItem = GUICtrlCreateMenuItem("Menu Item", $idMenu)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Hide")

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func _Hide()
    GUISetState(@SW_HIDE, $hGUI)
    ToolTip("Hiding for 3 seconds")
    sleep(3000)
    ToolTip("")
    WinActivate($hGUI)
    DllCall("User32.dll", "long", "AnimateWindow", "hwnd", $hGUI, "long", 300, "long", 0x00080000)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    Return 0
EndFunc

Func _Exit()
    Exit
EndFunc

Anyone seen this before?  Any ideas for a good workaround without playing winactivate hockey?  I tried _GUICtrlMenu_DrawMenuBar but it didn't have any effect.

Share this post


Link to post
Share on other sites



have you tried _WinAPI_RedrawWindow ?

Share this post


Link to post
Share on other sites

On Win 8.1 the behaviour is "normal", no dimming effect at least for me.


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

have you tried _WinAPI_RedrawWindow ?

Just tried it, it didn't seem to help.  I could be calling it wrong, but the func is returning 1.

On Win 8.1 the behaviour is "normal", no dimming effect at least for me.

Ah yes, OS flavor.  I should've mentioned.  I'm on Win 7 x64.

Share this post


Link to post
Share on other sites

Found a cheap workaround.

#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>

Opt("GUIOnEventMode", 1)

Local $hGUI = GUICreate("Test GUI w/ Menu", 300, 200)
Local $idMenu = GUICtrlCreateMenu("Menu")
Local $idMenuItem = GUICtrlCreateMenuItem("Menu Item", $idMenu)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Hide")

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func _Hide()
    GUISetState(@SW_HIDE, $hGUI)
    ToolTip("Hiding for 3 seconds")
    sleep(3000)
    ToolTip("")
    WinSetOnTop($hGUI, "", 1)
    DllCall("User32.dll", "long", "AnimateWindow", "hwnd", $hGUI, "long", 300, "long", 0x00080000)
    WinActivate($hGUI, "")
    WinSetOnTop($hGUI, "", 0)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    Return 0
EndFunc

Func _Exit()
    Exit
EndFunc

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