Jump to content
Sign in to follow this  
GoroX

Detect when hidden window exists

Recommended Posts

GoroX

Here's what I would like to do: Launch a window without showing it, send some messages to it and close it again. In order to do that, I thought I could use the following:

Run( ..., @SW_HIDE )   ; launch app
WinWait( ... )   ; wait for app's main window to become available so that we can send messages to it
WinMove( ... )   ; move window off screen to unhide it while still keeping it invisible from the user
SetWinState( ..., $SW_SHOW ) ; show window (off screen) so that I can send messages to it
ControlSend( ... ) ; send a bunch of messages including one that closes the window

...but it turns out that WinWait() goes into an infinite loop when I use Run() with the @SW_HIDE flag (works fine without the @SW_HIDE flag but window is briefly visible, which is unsightly). Which leads me to the following question:

Is there a different way to determine when a hidden window exists? Or, is there a different approach altogether to launch an app and send some messages to it without the user ever seeing it?

Thank you!

Share this post


Link to post
Share on other sites
Belini

Take a look at these commands:

WinExists ("title", "text"); verffica if the window is
WinActivate ("title", "text"); active window
WinSetTrans ("title", "text", 0); leaves the invisible window
Edited by Belini

Share this post


Link to post
Share on other sites
GoroX

Thanks Belini! I did have a look at the functions, alas, the problem was that I omitted a parameter from Run() so that the @SW_HIDE flag was passed as the "workingdir" parameter of Run()... :oops: So, the WinWait() function works just fine, even when using @SW_HIDE.

That said, I now have a different problem but that's a subject for a different post...

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  

×