Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nocturnal print via MUTEX and Run-App-and-Wait
Message
From
17/08/1999 19:47:11
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00254699
Message ID:
00254757
Views:
26
>Printing reports at night with a 16-bit application (QUEST) requires a single instance, therefore I refer to George's MUTEX class.
>There are many reports to be generated but QUEST can run only one-at-a-time and I must know when the previous QUEST has finished, referring to Ed's Run-App-and-Wait prg.
>I want to combine these two great ideas together!
>Run Quest Print, Wait, After Quest Print spooled start NEXT QUEST.

I don't see the problem here; if you queue up instances of Quest to be run sequentially and use LaunchAppAndWait(), VFP will sit and not execute another line of code until that finishes.

If what you want to do si launch a copy of Quest, then have VFP go off and do something, and periodically check to see if the previous instance has completed, that's really easy, too. You want to make sure that you're using my API_APPRUN class rather than just the sample FAQ code (you can download it from here on UT in th Files Section), and then start up an instance of Quest using launchApp - which runs the program and immediately returns control to VFP. You can periodically check the progress of the application using the object's CheckProcessExitCode() method; if returns a value other than 259, the other instance is done.

The code would look something like this:
SET CLASSLIB TO PROCESS ADDITIVE
oQuest = CREATEOBJ('API_APPRUN',cCmdLineOut, "C:\Gupta\", "HIDE")
oQuest.LaunchApp()
*  The app is running and so is VFP
*  to check the progress of the executable:
IF oQuest.CheckProcessExitCode() = 259
   * still running
ELSE
   * Done - you can now release the object
ENDIF
>
>I can't use a timer, end up with dead time...
>IDEAL would be
>=LaunchAppAndWait(cCmdLineOut, "C:\Gupta\", "HIDE")
>
>but the 'handle' is a number, ((that is consistent))
>WHICH is not recognized as a Screen title (as dictated in the MUTEX)
>
>The command line runs an instance of QUEST
>I do not know nor can I seem to assign handle/title for property testing.
>
>Any help would be great.
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