|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Windows API calls
I need to have a button on a form initiate an executable using the "shell" command, then "wait" for the executable to complete, and then (and only then) begin some processing.
The executable is an external (non-access) program that updates some SQL tables, and i need to process these tables once the executable has completed the update process. The SHELL command returns a Windows handler ID for the process that it initiates - can anyone help me with the API call that I would have to execute in a "do...while" loop to wait for the process to terminate? Thanks! Vinay URL |
|
#2
|
|||
|
|||
|
The eternal problem with shell. There is no direct way to know if the program has finished. What you can do is check Task Manager (with APIs, of course) if the program can be found there. Check this great site about APIs:
www.AllAPI.net '*** This routine launches a program ("BladeEnc.exe") with some cmd line params. The Shell command returns a process ID with which you can "query" the Task Manager (in simple words) Public Sub Encode(ByVal FileName As String) Dim HEncoderProcess As Long Dim CurrentExitCode As Long Dim EncoderProcessID As Long EncoderProcessID = Shell(mvarEncoderPath & "\BladeEnc.exe -32 -q -quiet -outdir=" & mvarEncodedFilePath & " " & FileName) 'Wait for encoding to be terminated 'Get a handle to the Process and Open HEncoderProcess = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, 0, EncoderProcessID) 'Loop until process exits Do DoEvents GetExitCodeProcess HEncoderProcess, CurrentExitCode Loop Until CurrentExitCode = 0 'raise the EncodingFinished event RaiseEvent EncodingFinished(FileName) End Sub |
|
#3
|
|||
|
|||
|
btw you will need to compile this stuff into a DLL which you can call then with CreateObject. This is because you cannot make API calls directly in ASP, instead you need to create objects which enclose these APIs.
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Windows API calls |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|