Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multitasking
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00659181
Message ID:
00664167
Vues:
33
Hi,
I finally had to use CreateProcess & WaitForSingleObject DLLs.
Program1 uses CreateProcess to start Program2 and the two continue asynchronously.
When Program1 has finished its job, it uses WaitForSingleObject DLL to make sure that Program2 is over and then it terminates.

Everything seems to be working fine on small volumes of data. I would really appreciate it if you could verify this code for me.

Ria

Program1 Code:

#DEFINE NORMAL_PRIORITY_CLASS 32
#DEFINE IDLE_PRIORITY_CLASS 64
#DEFINE HIGH_PRIORITY_CLASS 128
#DEFINE REALTIME_PRIORITY_CLASS 1600

* Return code from WaitForSingleObject() if
* it timed out.
#DEFINE WAIT_TIMEOUT 0x00000102

#DEFINE WAIT_OBJECT_O 0x000000

* This controls how long, in milli secconds, WaitForSingleObject()
* waits before it times out. Change this to suit your preferences.
#DEFINE WAIT_INTERVAL 0x00000FFFF &&5000
#DEFINE INFINITE 0x00000FFFF

.........................

RetCode = CreateProcess(0, File2Run, 0, 0, 1, ;
NORMAL_PRIORITY_CLASS, 0, 0, @start, @process_info)

* Extract the process handle from the
* PROCESS_INFORMATION structure.
hProcess = str2long(SUBSTR(process_info, 1, 4))

.........................
* Program1 continues

.........................

WaitForSingleObject(hProcess,INFINITE)

*End Program1
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform