Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem invoking pcAnywhere (DOS)
Message
From
08/12/2002 09:49:50
 
 
To
08/12/2002 00:53:50
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00730525
Message ID:
00730716
Views:
8
>Hi Ed:
>
>>If this is written in VFP5 or later, you might want to try using my API_APPRUN class as shown below:
>>
>>
SET CLASSLIB TO PROCESS ADDITIVE
>>oRun = CREATEOBJ('API_APPRUN','awremote -M=D -N="MCIB"','C:\AW','NOR')
>>oRun.LaunchAppAndWait()
>>? oRun.CheckProcessExitCode() && displays any error code issued from awremote
>>oRun=NULL
>>
>
>Yes the code is written in VFP 7. Not sure where this code will fit in with the code I already have. Are suggesting that I use your code only as shown above, or is it in conjunction with existing code.
>

This code completely replaces your old code to create and run the batch file.

>>You can instead use the LaunchApp() method and poll for termination using CheckProcessExitCode() (it will return 259 until the program actually is terminated.) If you feel that it hung, you can invoke the TerminateProcess() method to force the launched app to close and release all its resources back to the OS in an immediate fashion.
>>
>>No batch file involved, and the behavior controlled by FOXRUN.PIF is not an issue; in fact, if a PIF is associated with AWREMOTE, it'll be used to control the execution environment.
>
>The two paragraphs above are really way above what I know - how do I accomplish this? Thanks Ed.

Polling simply is checking periodically for something to happen. In the example I give above, I assume that you will run to termination:

.
.
oRun.LaunchAppAndWait() && VFP is paused until your command is finished
.
.

With polling, you check to see if the other app finished running periodically; it provides you with the option of doing something in parallel, or if it doesn't finish within a reasonable amount of time, doing something like calling oRun.TerminateApp() to kill it off:

.
.
oRun.LaunchApp()
.
DO WHILE oRun.CheckProcessExitCode() = 259 && app still running
.
. do something, wait a little while and go back and check
.
ENDDO
.
.

The TerminateApp() method acts like you've gone to Task Manager and killed off a running task - it dies, regardless of what it's doing or how it got hung up. If you want to call it, you can. If the app has already terminated, nothing bad happens.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform