How to run a another application in sync.

Hi all,
    I'm looking for a way to run a shell command (Linking to another .exe) in sync (i.e. my program will will not continue to execute until the other application ends).

    How can I also detect if my application (NOT the one I'm calling) is already running (since I only want one instance of it running ever)

    Thanks
LVL 1
DragonWolfAsked:
Who is Participating?
 
priya_pbkConnect With a Mentor Commented:
sorry again, i pasted the same code:

It should be :

Private Sub Form_Load()
If App.PrevInstance = True Then MsgBox "Application already Running": Exit Sub
End sub

-priya :0)

0
 
DragonWolfAuthor Commented:
I can now run a program in sync,
My second question still needs answering,
when executing a DOS .exe file, using the shell() can I make it full screen?
0
 
gencrossCommented:
Where is this second question posted at?

Did the code I provided help you in answering the first question(s)?
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
priya_pbkCommented:
you can check for any of the previous Instance if running like this:

Private Sub Form_Load()
if App.PrevInstance<>0 then Msgbox "Appication already running" :End
End Sub

Hope this helps!

-priya
0
 
DragonWolfAuthor Commented:
what code?

The questions I'm currently asking are only in this thread,
they are:

  How can I also detect if my application is already running (since I only want one instance of it running ever)

  How can I run a DOS exe file in full screen?
0
 
DragonWolfAuthor Commented:
Thanks Priya
0
 
priya_pbkCommented:
sorry that should be:

Private Sub Form_Load()
if App.PrevInstance<>0 then Msgbox "Appication already running" :End
End Sub

-priya
0
 
DragonWolfAuthor Commented:
priya

Whats the difference between the those two snippets of code in your comments?
0
 
DragonWolfAuthor Commented:
hehe
    I thought so ^^
0
 
priya_pbkCommented:
BTW, it should be "End" and not "Exit Sub"

0
 
DragonWolfAuthor Commented:
Question had changed so much, that I sohuld have started a new thread, but priya answered one of the many questions in this thread.

    Thankx ^^
0
 
priya_pbkCommented:
Thanks for the points!

ok, for the opening it as full screen,use the shell function like this:

syntax:
Shell pathName, vbMaximizedFocus

[where pathname is where your command prompt exe exists in your C:\....

hope this helps(i have not tested)]
-priya

0
 
DragonWolfAuthor Commented:
Just tried it.
Same effect as if I left out the cmd.exe
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.