Discussion:
How to run a lengthy utility in the background
(too old to reply)
Greg Hill
2008-11-15 19:41:31 UTC
Permalink
I need to run a utility form(or program; which ever will work) that fills
tables with data.
I call it from function form_onOpen of a Main Menu form.
It's takes awhile to perform and I'd like to allow the user to continue
working while it runs in the background.
The utility form opens at the bottom of the screen with a progress bar.
It's running as an SDI, modeless window but it won't let me continue until
it's done.
If Glenn's suggestion is not a fit for your app, look at the timer class in
dBASE Help.

Also look at _app.executeMessages() and make sure you put that in your
loops, note, only use it were needed because it will slow down the loop just
a touch.

The answer depends on how intense the process is and how long you want it to
take. You can use a timer to fire a loop when you want and it is very
transparent.

Greg Hill
Glenn Johansen
2008-11-15 18:58:53 UTC
Permalink
Make it a seperate exe and call it from your application, then you can keep
working.

- glenn
I need to run a utility form(or program; which ever will work) that fills
tables with data.
I call it from function form_onOpen of a Main Menu form.
It's takes awhile to perform and I'd like to allow the user to continue
working while it runs in the background.
The utility form opens at the bottom of the screen with a progress bar.
It's running as an SDI, modeless window but it won't let me continue until
it's done.
Could someone tell me how to do this?
Thanks,
Ted
Andrew Shimmin
2008-11-16 21:28:22 UTC
Permalink
Ted,

Bite the bullet and make it a standalone executable. Trying to do it in the main application is going to drive you and/or your users nuts.

regards, andrew
Hi Glenn,
If I make it an .exe I'd have to deal with the .ini file.
It also accesses a bunch of different BDE databases which are all set up
in the Main App.
Thought there may be a way to do it within the main app.
Thank,
Ted
Post by Glenn Johansen
Make it a seperate exe and call it from your application, then you can
keep working.
- glenn
I need to run a utility form(or program; which ever will work) that
fills tables with data.
I call it from function form_onOpen of a Main Menu form.
It's takes awhile to perform and I'd like to allow the user to
continue working while it runs in the background.
The utility form opens at the bottom of the screen with a progress bar.
It's running as an SDI, modeless window but it won't let me continue
until it's done.
Could someone tell me how to do this?
Thanks,
Ted
Rich - AutoTraker Inc.
2008-11-17 12:33:48 UTC
Permalink
And if use create to run the new EXE, on a dual core machine it will have
almost no speed impact on your main application.
Rich...
Post by Andrew Shimmin
Ted,
Bite the bullet and make it a standalone executable. Trying to do it in
the main application is going to drive you and/or your users nuts.
regards, andrew
Glenn Johansen
2008-11-17 14:49:12 UTC
Permalink
" create"?? rich what is that ?

-glenn
Post by Rich - AutoTraker Inc.
And if use create to run the new EXE, on a dual core machine it will have
almost no speed impact on your main application.
Rich...
Post by Andrew Shimmin
Ted,
Bite the bullet and make it a standalone executable. Trying to do it in
the main application is going to drive you and/or your users nuts.
regards, andrew
Rich - AutoTraker Inc.
2008-11-17 17:14:39 UTC
Permalink
Look at RunWait by Jim Sare in the dUFLP to launch your other EXE rather
than using the RUN command.
Of course you don't want your launching app to wait so set nWait to zero.
If I'm not mistaken this will have your new EXE running as a new thread.
Then if you have a dual core, the new thread with use the second half
speeding up both processes.
Rich...
Post by Glenn Johansen
" create"?? rich what is that ?
-glenn
Post by Rich - AutoTraker Inc.
And if use create to run the new EXE, on a dual core machine it will have
almost no speed impact on your main application.
Rich...
Post by Andrew Shimmin
Ted,
Bite the bullet and make it a standalone executable. Trying to do it in
the main application is going to drive you and/or your users nuts.
regards, andrew
Glenn Johansen
2008-11-16 21:20:22 UTC
Permalink
The other thing you can do is setup your application to take a parameter and
run the app a second time.

eg. myapp.exe

* start of myapp.exe
shell(.f.,.f.)
parameter cProgram
if pcount()>1
do &cprogram
quit
endif

* otherwise start your app
start my application here...

-glenn
Hi Glenn,
If I make it an .exe I'd have to deal with the .ini file.
It also accesses a bunch of different BDE databases which are all set up
in the Main App.
Thought there may be a way to do it within the main app.
Thank,
Ted
Post by Glenn Johansen
Make it a seperate exe and call it from your application, then you can
keep working.
- glenn
I need to run a utility form(or program; which ever will work) that fills
tables with data.
I call it from function form_onOpen of a Main Menu form.
It's takes awhile to perform and I'd like to allow the user to continue
working while it runs in the background.
The utility form opens at the bottom of the screen with a progress bar.
It's running as an SDI, modeless window but it won't let me continue
until it's done.
Could someone tell me how to do this?
Thanks,
Ted
Ted
2008-11-16 19:37:24 UTC
Permalink
Hi Glenn,
If I make it an .exe I'd have to deal with the .ini file.
It also accesses a bunch of different BDE databases which are all set up in
the Main App.
Thought there may be a way to do it within the main app.

Thank,
Ted
Post by Glenn Johansen
Make it a seperate exe and call it from your application, then you can
keep working.
- glenn
I need to run a utility form(or program; which ever will work) that fills
tables with data.
I call it from function form_onOpen of a Main Menu form.
It's takes awhile to perform and I'd like to allow the user to continue
working while it runs in the background.
The utility form opens at the bottom of the screen with a progress bar.
It's running as an SDI, modeless window but it won't let me continue
until it's done.
Could someone tell me how to do this?
Thanks,
Ted
Ted
2008-11-18 20:05:40 UTC
Permalink
Thank you all for the input.
I went ahead and build an executable to handle it.

Going to take a look at the RunWait.prg.
Thank again,
Ted
I need to run a utility form(or program; which ever will work) that fills
tables with data.
I call it from function form_onOpen of a Main Menu form.
It's takes awhile to perform and I'd like to allow the user to continue
working while it runs in the background.
The utility form opens at the bottom of the screen with a progress bar.
It's running as an SDI, modeless window but it won't let me continue until
it's done.
Could someone tell me how to do this?
Thanks,
Ted
Loading...