Sign in to follow this  
Followers 0
Emiel Wieldraaijer

Small Problem with Run Command

3 posts in this topic

Hi All,

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

Example

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

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

Thnx

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

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

Hi Siao,

thnx

you are totally correct..

I hope your image has nothing to do with my stupidity

hahahahahaha

Emiel


Best regards,Emiel Wieldraaijer

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