Jump to content
Sign in to follow this  
Gui

Tell if a GUI is hidden overall?

Recommended Posts

Gui

Aye guys. Just want to know if you could just see if a GUI is hidden overall ( Minimized to Taskbar, or inside the tray.) ; WINGetState , 2 = Window is visable. So I want 'Not 2'

I've tried :

$state = WinGetState ($Form1)   
    If BitAND($state, Not 2) Then  ; Window is Not visable overall. - Doesn't work.
        GUISetState(@SW_RESTORE)
        Sleep(2500)
    EndIf

Would you use BitNOT? Sorry i'm new to Bit___ stuff. Help is appreciated. Thanks!

Regards,

GUI

Edited by Gui

Share this post


Link to post
Share on other sites
somdcomputerguy

Hmm. Oh well. I might have a use for something like this, but I can't do anything right now. If I come up with something later, I'll post some code that actually works!


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
martin

Thanks for the help! Didn't think of that. Sorry but it didn't work. : ( Thanks though!

If you want to check if it's minimized then

Run("Notepad.exe")
Sleep(2000)
While 1
    If Not WinExists("Untitled") Then Exit
    $state = WinGetState("Untitled")
    If BitAND($state, 16) Then ; Window is minimized.
        WinSetState("Untitled", "", @SW_RESTORE)
 EndIf

 Sleep(2500)
WEnd
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Gui

If you want to check if it's minimized then

Run("Notepad.exe")
Sleep(2000)
While 1
    If Not WinExists("Untitled") Then Exit
    $state = WinGetState("Untitled")
    If BitAND($state, 16) Then ; Window is minimized.
        WinSetState("Untitled", "", @SW_RESTORE)
        Sleep(2500)
    EndIf
WEnd

Yeah but the thing is, what if it's minimized to tray as well :D? It will only see if it's minimized to task bar. That's why i'm trying to see if it's generally NOT visable. (So it could be minimized or in system tray. :huggles: )

Share this post


Link to post
Share on other sites
picea892

#Include <WinAPI.au3>
HotKeySet("q","visible")
func visible()
    $pos=WinGetPos("AutoIt Help","")
    if $pos[0]=-32000 or _WinAPI_IsWindowVisible(WinGetHandle("AutoIt Help",""))=0 Then
        ConsoleWrite("can't see me"&@CRLF)
    Else
        ConsoleWrite("Here I am"&@CRLF)
    EndIf
EndFunc
While 1
sleep(100)
WEnd

Share this post


Link to post
Share on other sites
Gui

#Include <WinAPI.au3>
HotKeySet("q","visible")
func visible()
    $pos=WinGetPos("AutoIt Help","")
    if $pos[0]=-32000 or _WinAPI_IsWindowVisible(WinGetHandle("AutoIt Help",""))=0 Then
        ConsoleWrite("can't see me"&@CRLF)
    Else
        ConsoleWrite("Here I am"&@CRLF)
    EndIf
EndFunc
While 1
sleep(100)
WEnd

Worked beautifully thanks! :D

Share this post


Link to post
Share on other sites
martin

You originally asked to know if the window is minimized or in the tray. In the tray might mean the window is hidden but minimized to the task bar does not. So you need to check for both conditions.

Run("Notepad.exe")
Sleep(2000)
winsetstate("Untitled","",@SW_HIDE)
sleep(1000)
While 1
    If Not WinExists("Untitled") Then Exit
    $state = WinGetState("Untitled")
    If BitAND($state, 16) or NOT BitAnd($state,2) Then ; Window is minimized or not visible
        WinSetState("Untitled", "", @SW_SHOW)
        wiNSETSTATE("Untitled", "", @SW_restore)
    EndIf
    Sleep(200)
WEnd

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.