How To Know Another Application Is Running?

jothis

Active Member
Licensed User
Hello Friends

I have A Program Which For Opening A image Using shell()
And It Open A image Using Default Picture Viewer And It is Successfully.
But I want To Know The Viewer is Closed Or It is Still Running

Is it Possible In Basic 4 ppc?

Please Anyone help me

jothis
:sign0085:
 

Attachments

  • detecting.zip
    26.6 KB · Views: 231

jothis

Active Member
Licensed User
Hi, AGAIN,

I clarify my request.

Please check my program... (please run the attached file questionfile.zip)

Sub Globals
'Declare the global variables here.
file=AppPath &"\Blue hills.jpg"
End Sub

Sub App_Start
Form1.Show
End Sub
Sub Button3_Click
Shell(file,"")
Msgbox("Do you liked this image?")
End Sub


Sub Button4_Click
Form1.Close
End Sub

Here I want to reach at message box only after Shell() program.

That is, I wish the message to come only after the opend a image.
But message pop up came before open the image.

So I actually want , the Msgbox("Do you liked this image?") or any program run after the shell() finished.

I think you understood my question.

Can you please inform me. I need to use lot of shell programs in my works.
this is only a example.

Awaiting for your help

regards
Jothish:sign0085:
 
Last edited:

sitajony

Active Member
Licensed User
Hi, did you try DoEvents()? I'm not realy sure if it works...:
B4X:
[B]Sub Button3_Click[/B]
[B]  Shell(file,"")[/B]
[B]  DoEvents()[/B]
[B]  Msgbox("Do you liked this image?")[/B]
[B]End Sub[/B]
If it doesn't work create a Timer who show the MsgBox after few seconds otherwise maybe somebody else will give you a better idea...

Edit:
In fact with DoEvents() it doesn't work apparently...

The attached file is an example with a Timer...
Tell me if it works...
 
Last edited:

jothis

Active Member
Licensed User
I tried with DoEvents(). But I got a error message as
Error parsing() as Number.
And I think, I can use a timer, because it is not practicable.
I need to wait for help again,

Thank you Sita Johny for your help.

regards Jotis
 

sitajony

Active Member
Licensed User
I tried with DoEvents(). But I got a error message as
Error parsing() as Number.
And I think, I can use a timer, because it is not practicable.
I need to wait for help again,

Thank you Sita Johny for your help.

regards Jotis
Sorry it's not DoEvents() but DoEvents, I typed the VB/C Syntax...
 

Byak@

Active Member
Licensed User
Hi, AGAIN,
So I actually want , the Msgbox("Do you liked this image?") or any program run after the shell() finished.
if you want to waiting while program not exit and then show msg-you can use a ProcessObject in Threading.dll

Sub Button3_Click
process.start(file,"")
End Sub


sub process_exit
Msgbox("Do you liked this image?")
end sub


if not-you can use this code

Sub Button3_Click
Shell(file,"")
sleep(3000)
Msgbox("Do you liked this image?")
End Sub
 

agraham

Expert
Licensed User
Longtime User
I'm afraid that will only work if you directly invoke an exe. Indirectly invoking a default application by means of a picture does not create a process so you should invoke the viewer program directly and pass the path to the picture as a parameter.

picpath = AppPath & "\Blue hills.jpg"
process.start(yourviwer.exe,picpath)
 

jothis

Active Member
Licensed User
Thank you all,

its working well

the code i used to test is given below.


Sub Globals
'Declare the global variables here.
End Sub

Sub App_Start
Form1.Show
Process.New1
End Sub
Sub Button3_Click
Process.start(AppPath & "\package.exe","")
End Sub
Sub process_exit
Msgbox("Do you liked this image?")
End Sub
Sub Button4_Click
Form1.Close
End Sub


Thank you all.

best regards,
Jothis
 

RacingDog

Active Member
Licensed User
process.start ? Just did a search in the Help file and the odd hopefully titled library Help files and can't find it. Looked at the specifications page on your site and a few other related pages. Still no joy.

Don't need it right now, but before I retired it was essential knowledge in the environments I used to work in, so it's only a matter of time before I think of some reason to want it again.
 
Top