Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pause main calling prog while .app is running. 1

Status
Not open for further replies.

torturedmind

Programmer
Jan 31, 2002
1,052
PH
I have the following as part of the code in my main calling program:
Code:
DO dat_mgr

[i]<Do something...>[i]

dat_mgr is an .app file that is also called somewhere else in the program. My question is, how will I tell the main calling program to pause until the called .app is finished?

TIA

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
IT does already. VFP is single threaded, if you DO some.app this is not the same as running a separate EXE, the app code runs within the already running process and thread and you only continue after the app finishes.
What can be the case is, that you automate separate processes and then parallelism might catch you, like it just recently happened carolx in thread184-1747189

Bye, Olaf.
 
Thanks for the quick response. So the code is something like this:

Code:
USE mytable1 IN 0

[i]<do something...>[/i]

DO dat_mgr

USE IN mytable1
[i]<do something...>[/i]

The called dat_mgr.app is looking for a mytable1 I know I already USEd beforehand. It turned out the table is already closed before dat_mgr finishes what it was doing on that table. So to make sure, I put a simple MESSAGEBOX between the DO and USE commands like so...

Code:
DO dat_mgr
MESSAGEBOX("This should not be executed.")
USE IN mytable1

Sure enough, the message was displayed even before dat_mgr displays it's one-and-only form. I don't have any commands that may automate separate processes like what you've said so I don't know what's going on here. Any ideas?


kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
From the help on DO:

If you do not include an extension with the program you execute, Visual FoxPro looks for and executes versions of the program in the following order:

Executable (.exe)
Application (.app)
Compiled (.fxp)
Program (.prg)

So you have any dat_mgr.exe inside your PATH? Then you will be starting this and not the app, and this causes another process.

Simply be more verbose (what I always recommend) and DO dat_mgr.app

Bye, Olaf.

 
Nope, haven't got dat_mgr.exe just .app. Also tried your suggestion of being verbose and include the ".app", didn't change a thing except display the only form in the .app. The MESSAGEBOX that I put still executed when it's not supposed to.

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
The form you start is modal? If not, you return before the form exits, of course. That would also be the case, if it wasn't a separate app but prg in your exe.

Bye, Olaf.
 
Thank you, good sir for pointing me to the right direction. Actually, the code I posted is called thru a command button within a form from the main calling program and that main form is modal. The form from the called program (within dat_mgr.app) is not (i.e., 0 or modeless). When I changed the child form's WindowType property to 1 (modal), it worked! The main calling program waits for dat_mgr to finish before executing the succeeding commands. Funny thing is, I've done this many times before and I honestly never encountered such behavior. Maybe because I didn't pay much attention to the WindowType property and how it affects the form's over-all behavior. Now I have to remember this so as not to get trapped in it again. Anyways, it's working now. I really appreciate the help. Here's a star for you, sir. [thanks]

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top