Jump to content

Tell if a GUI is hidden overall?


Gui
 Share

Recommended Posts

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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: )
Link to comment
Share on other sites

#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

Link to comment
Share on other sites

#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
Link to comment
Share on other sites

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.
Link to comment
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
 Share

  • Recently Browsing   0 members

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