Sign in to follow this  
Followers 0
Kaeft

@SW_HIDE not working

9 posts in this topic

#1 ·  Posted (edited)

I'm not sure if this is just my system or if it's a bug. I've searched around the forum a bit, but you know how the search function can be... Seems that no one else is having this problem from the results I see.

I run XP Pro SP3 under a virtual box.

Any time I try using the @SW_HIDE in a Run or Shellexecute or Runwait, it fails to hide the window.

I've taken a rather round about way of fixing the problem:

Func SleepTillWinExists($window,$timeout)   ; This function sleeps until it finds that a window exsists. Acompany with a while loop and you can fly. $timeout is 1/4 a second
$exsist = 0
If WinExists($window) Then
Return True
Else
    Sleep(250)
    $timeout -=1
    If $timeout <= $exsist Then
    $timeout = 0
    Return False
    Else
    SleepTillWinExists($window,$timeout)
    EndIf
EndIf
EndFunc

........................... more lines of code

Run("a program" Sniped)
            While $open = 1
                If SleepTillWinExists("A window",2) Then
                    $open = 0
                Else
                    If SleepTillWinExists("a window",2) Then
                        $open = 0
                    Else
                        $open = 1
                    EndIf
                EndIf
            WEnd
            WinSetState("A window","",@SW_HIDE)

So as you can see this works.. but it is quite a hassle. Does @SW_HIDE work for you guys?

Might also allow WinExists the option of case sensitivity :(

Edited by Kaeft

Share this post


Link to post
Share on other sites



Hi welcome to the forum

I think you may have better success using class. I don't use firefox but on opera the window title changes based on the tab that is active, the class never changes. As per the helpfile

WinSetState("[CLASS:Notepad]", "", @SW_HIDE)

You can get the class from the Au3info tool.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Well winsetstate is working completely correctly and I would agree with you to use a class, all except I usually have more than one firefox open at a time. But the title is constant so that works in that respect.

I was just wondering if @SW_HIDE is broken or if it's just my computer.

Edited by Kaeft

Share this post


Link to post
Share on other sites

Yup, works for me.

Share this post


Link to post
Share on other sites

Yup, works for me.

Hmm are you running the latest or the beta? What Version of windows do you have? lol most likely not running under virtual machine. That might be my problem.

Share this post


Link to post
Share on other sites

You are perhaps accounting for the windows that you see but not the ones that you do not. If a window has the same title but is hidden, and it gets chosen with your code, then WinSetState() will work correct as it is hiding a window which is already hidden.

So to debug and remove doubt, then try this freeware from Nirsoft named WinLister. It can show all windows in a listview control. Even zero size windows can be displayed. This utility is good for these window title issues that are hidden from you.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Well.. no that's not what I'm saying. WinSetState works perfectly at hiding.

I want it to hide as soon as it runs so that I never see the window. Run has the option to use @SW_HIDE in it, but it's not running and hiding, it's just running.

Also thanks for the link to that. That could be really useful in many areas of my work :(

Edited by Kaeft

Share this post


Link to post
Share on other sites

I want it to hide as soon as it runs so that I never see the window. Run has the option to use @SW_HIDE in it, but it's not running and hiding, it's just running.

That depends on the internal coding of the application. If they force the window to show then it may prevent you doing anything about it with the initial execution of it.

Share this post


Link to post
Share on other sites

Interesting. The program in question is Firefox. I'm going to try something simple like notepad.

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