Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using CreateProcess repeatedly
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00504932
Message ID:
00505197
Views:
29
>Timothy,
>
>(once again with everything pasted in a logical sequence *L*)
>
>The scripting host works just fine with DOS commands:
>
>oWSH = createobject( "wscript.shell" )
>oWSH.Run( "command.com /c dir > c:\dir.txt", 1, .t. )
>modi file c:\dir.txt nowait
>
>The command.com /c business is only needed because dir is an internal command. You should be able to:
>
>oWSH( "c42pdf.exe " + lcInpuFilename + " > logfile.txt", 1, .t. )
>modi file logfile.txt
>
>Change the 1 to a 0 once you've got this debugged and working to prevent the display of the DOS window.
>

df,

What got me wondering (and I've never tried this) was closing the DOS window. Would this work in above?< Thinking about who he's asking the question of makes him think that this post wouldn't be here if not >

>>I am running a VFP 6.0 EXE on a Windows 2000 Workstation. This program converts TIF files to PDF by calling a 32-bit DOS application called c42pdf.exe. We have thousands of TIF files to convert. So, I created the VFP program to repeatedly call c42pdf.exe to convert each TIF file. The program creates around 4000 PDF files per hour and steadily decreases every hour. If I terminate the program and start it up, it resumes the same pattern of decreasing work per hour.
>>
>>The code for the program is scattered across different methods. I can supply it if it is helpful. Here is basically what I do:
>>
>>1) Use FCREATE() to create an input file, and close it with FCLOSE().
>>2) Call Win32 CreateFile() to create a log file.
>>3) Call Win32 CreateProcess() to call c42pdf.exe. Redirect standard error and output to the log file (step 2). Hide the DOS window by changing ShowWindow field in StartupInfo.
>>4) Get process and thread IDs from ProcessInfo.
>>5) Call Win32 WaitForSingleObject() to wait until process is complete.
>>6) Call Win32 TerminateProcess() to end process.
>>7) Call Win32 CloseHandle() to close thread, process, and log file (step 2).
>>8) Use FOPEN() to open log file, FGETS() to read it, and FCLOSE() to close it.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform