473,326 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Is a Shelled Process still Running

ShellStr = "C:\temp\wzzip " & ZipOptions & " " & ZipTo & " " & ZipFrom
ShellRet=Shell(ShellStr)

.. . . . . .
msgbox "Done"

How can I determin whether the Shelled process is still running.
[I want to delay the Done message until the shelled process has completed]

--
Jim Bunton
jB*****@Blueyonder.co.uk
13 Westbourne Road
Trowbridge
Wilts. BA14 0AJ
Tel: 01225 765 541
Mobile: 07919 283 968


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/2003
Jul 17 '05 #1
4 7469
On Tue, 18 Nov 2003 12:08:58 -0000, "J Bunton"
<jB*****@BlueYonder.co.uk> wrote:
ShellStr = "C:\temp\wzzip " & ZipOptions & " " & ZipTo & " " & ZipFrom
ShellRet=Shell(ShellStr)

. . . . . .
msgbox "Done"

How can I determin whether the Shelled process is still running.
[I want to delay the Done message until the shelled process has completed]


Here is my testbed for this
- it looks like I lifted most of it from somewhere
- there is a pretty good case for using CreateProcess rather than
Shell

Option Explicit

Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long

Private Const SYNCHRONIZE = &H100000
Private Const PROCESS_QUERY_INFORMATION = &H400

Private Declare Function GetExitCodeProcess _
Lib "kernel32" _
(ByVal hProcess As Long, _
lpExitCode As Long) As Long
Dim pID As Long

Sub Form_Load()
Command1.Caption = "Shell"
Command2.Caption = "Get Status"
End Sub

Private Sub Command2_Click()
Dim Ok&, ECode&
Dim hProcess&, Q&

Q = PROCESS_QUERY_INFORMATION Or SYNCHRONIZE
hProcess = OpenProcess(Q, False, pID)
' ---
Ok = GetExitCodeProcess(hProcess, ECode)
MsgBox Str$(Ok) + Str$(ECode)
' ---
If hProcess Then
CloseHandle hProcess
End If

End Sub
Sub Command1_Click()

Dim Style%, Cmd$

' Style = vbHide
Style = vbNormalFocus
Cmd$ = "DIR C:\ /P"

pID = Shell(Environ("Comspec") + " /C " + Cmd, Style)

End Sub
Jul 17 '05 #2
Thanks for your response - will experiment with this

[In the mean time - 'CreateProcess' no reference to this in my (rather
ancientcirca 6 yrs) old version of VB. Is this a VB feature or an api
call?]

"J French" <er*****@nowhere.com> wrote in message
news:3f****************@news.btclick.com...
On Tue, 18 Nov 2003 12:08:58 -0000, "J Bunton"
<jB*****@BlueYonder.co.uk> wrote:
ShellStr = "C:\temp\wzzip " & ZipOptions & " " & ZipTo & " " & ZipFrom
ShellRet=Shell(ShellStr)

. . . . . .
msgbox "Done"

How can I determin whether the Shelled process is still running.
[I want to delay the Done message until the shelled process has
completed]
Here is my testbed for this
- it looks like I lifted most of it from somewhere
- there is a pretty good case for using CreateProcess rather than
Shell

Option Explicit

Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long

Private Const SYNCHRONIZE = &H100000
Private Const PROCESS_QUERY_INFORMATION = &H400

Private Declare Function GetExitCodeProcess _
Lib "kernel32" _
(ByVal hProcess As Long, _
lpExitCode As Long) As Long
Dim pID As Long

Sub Form_Load()
Command1.Caption = "Shell"
Command2.Caption = "Get Status"
End Sub

Private Sub Command2_Click()
Dim Ok&, ECode&
Dim hProcess&, Q&

Q = PROCESS_QUERY_INFORMATION Or SYNCHRONIZE
hProcess = OpenProcess(Q, False, pID)
' ---
Ok = GetExitCodeProcess(hProcess, ECode)
MsgBox Str$(Ok) + Str$(ECode)
' ---
If hProcess Then
CloseHandle hProcess
End If

End Sub
Sub Command1_Click()

Dim Style%, Cmd$

' Style = vbHide
Style = vbNormalFocus
Cmd$ = "DIR C:\ /P"

pID = Shell(Environ("Comspec") + " /C " + Cmd, Style)

End Sub

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/2003
Jul 17 '05 #3
Sorry - I have seen what CreateProcess is now!

"J Bunton" <jB*****@BlueYonder.co.uk> wrote in message
news:mt***********@news-binary.blueyonder.co.uk...
Thanks for your response - will experiment with this

[In the mean time - 'CreateProcess' no reference to this in my (rather
ancientcirca 6 yrs) old version of VB. Is this a VB feature or an api
call?]

"J French" <er*****@nowhere.com> wrote in message
news:3f****************@news.btclick.com...
On Tue, 18 Nov 2003 12:08:58 -0000, "J Bunton"
<jB*****@BlueYonder.co.uk> wrote:
ShellStr = "C:\temp\wzzip " & ZipOptions & " " & ZipTo & " " & ZipFrom
ShellRet=Shell(ShellStr)

. . . . . .
msgbox "Done"

How can I determin whether the Shelled process is still running.
[I want to delay the Done message until the shelled process has

completed]

Here is my testbed for this
- it looks like I lifted most of it from somewhere
- there is a pretty good case for using CreateProcess rather than
Shell

Option Explicit

Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long

Private Const SYNCHRONIZE = &H100000
Private Const PROCESS_QUERY_INFORMATION = &H400

Private Declare Function GetExitCodeProcess _
Lib "kernel32" _
(ByVal hProcess As Long, _
lpExitCode As Long) As Long
Dim pID As Long

Sub Form_Load()
Command1.Caption = "Shell"
Command2.Caption = "Get Status"
End Sub

Private Sub Command2_Click()
Dim Ok&, ECode&
Dim hProcess&, Q&

Q = PROCESS_QUERY_INFORMATION Or SYNCHRONIZE
hProcess = OpenProcess(Q, False, pID)
' ---
Ok = GetExitCodeProcess(hProcess, ECode)
MsgBox Str$(Ok) + Str$(ECode)
' ---
If hProcess Then
CloseHandle hProcess
End If

End Sub
Sub Command1_Click()

Dim Style%, Cmd$

' Style = vbHide
Style = vbNormalFocus
Cmd$ = "DIR C:\ /P"

pID = Shell(Environ("Comspec") + " /C " + Cmd, Style)

End Sub

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/2003

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/2003
Jul 17 '05 #4
On Tue, 18 Nov 2003 18:53:08 -0000, "J Bunton"
<jB*****@BlueYonder.co.uk> wrote:
Sorry - I have seen what CreateProcess is now!


Go to www.AllAPI.net and get their downloadable API Guide

- it is invaluable

Also - be careful with INFINITE ....
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dw85745 | last post by:
I shelled notepad as a child of an MDI. Works great. When taking the same code and using on a VB5.exe (my code) the program remains as an SDI rather than becoming a child. Suggestions...
0
by: e | last post by:
Hello Friends, I want to know, how can i get, shelled window current position on the screen with VB:DOTNET. I know the window handle but i couldnt do it with getwindowplacement api. Is there any...
1
by: John Baker | last post by:
I have an Access frontend that controls the running of several MS SQL Server DTS packages (among other things). I dynamically build a command line for dtsrun, and then use the ShellWait command...
2
by: Ewa Sowa | last post by:
I'm using CeCreateProcess to run a program that installs myApp.exe on my Pocket PC. If myApp is already installed, a dialog box pops up asking if you want to reinstall. Right after myApp.exe is...
4
by: Mohsen Aghazadeh | last post by:
In my application I wait for a shelled application to finish and continue to work. Everything works fine but when the shelled program is up and user tries to open other applications (outside of my...
0
by: | last post by:
In my application I wait for a shelled application to finish and continue to work. Everything works fine but when the shelled program is up and user tries to open other applications (outside of...
3
by: Rick | last post by:
We have a VB 6 app which opens a DDE Link to another application. All runs fine under VB6 debugger and as a compiled app. We Shell/Process.Start this VB6 app from an VB .Net app with WaitForExit....
6
by: SStory | last post by:
I have an exe and need to pass a filepath which has spaces and would normally be surrounded by " " if done from the Window Start -- Run dialog... How can I get the quotes around the strings I...
6
by: rdemyan via AccessMonster.com | last post by:
Is there a way, in code, to move a shelled application on the screen. I've got the shelled app to open and it centers itself. I would like to move it to the right using code, but I don't know...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.