Jump to content
Sign in to follow this  
Emiel Wieldraaijer

Small Problem with Run Command

Recommended Posts

Hi All,

I've got a small problem with hidden a program and showing it afterwards


$ProgramPID = Run("ProgramName.exe", "", @SW_HIDE)
$PWC1 = ProcessWait(ProgramName.exe)
If $PWC1 = "1" Then
        WinSetState("ProgramTitle", "", @SW_SHOW)
        ; Also tried  WinActivate("ProgramTitle")

Sometimes the program is not shown but the process is running.

I know i do not have to use the @SW_HIDE but this is not the complete code



Best regards,Emiel Wieldraaijer

Share this post

Link to post
Share on other sites

Have you checked the return value of WinSetState()? I think it fires too soon.

Because, process is not the same as window. If process exists, it doesn't mean any window belonging to that process exist yet, it just means that process exists. Some programs really take their time initializing data before creating main window.

WinWait/WinExists would make more sense than ProcessWait in your case.

Edited by Siao

"be smart, drink your wine"

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...