Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
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  
Old August 26th, 2003, 09:29 PM
vmehta vmehta is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 vmehta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to vmehta Send a message via Yahoo to vmehta
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

Reply With Quote
  #2  
Old October 8th, 2003, 07:32 AM
m_lazor m_lazor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Luxembourg
Posts: 156 m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
  #3  
Old October 8th, 2003, 07:35 AM
m_lazor m_lazor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Luxembourg
Posts: 156 m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Windows API calls


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway