473,698 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to wait for command window to exit?

I have loop that calls a Sub that runs the following code:

Dim WinZip As System.Diagnost ics.Process
Dim args As String = " -Pru -ex " & lblFolder.Text & "\" & PCName &
".zip @""" & appPth & "WksBkup.tx t"""
WinZip.Start("c :\Program Files\WinZip\wz zip.exe", args)
WinZip.WaitForE xit()
Do
If WinZip.HasExite d = True Then Exit Do
Loop
MsgBox("suppose dly exited")

However, it does not wait, and the message box never appears. I get
several command windows running WinZip at simultaneously. The program
does not block, If I click the button again, I get even more
simultaneously running command windows. But I can't get the program to
wait or even show me the messagebox.

Any ideas?

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #1
4 2808
Hi,

I prefer to use a processstartinf o for starting an application
with arguments.

http://msdn.microsoft.com/library/de...classtopic.asp

Second Add application.doe vents to your loop so it can finish it the
winzip.hasexite d is not true when run the first time.

Do
If WinZip.HasExite d = True Then Exit Do
Application.DoE vents
Loop

Ken
-------------------
"Terry Olsen" <to******@hotma il.com> wrote in message
news:uD******** ******@TK2MSFTN GP10.phx.gbl...
I have loop that calls a Sub that runs the following code:

Dim WinZip As System.Diagnost ics.Process
Dim args As String = " -Pru -ex " & lblFolder.Text & "\" & PCName &
".zip @""" & appPth & "WksBkup.tx t"""
WinZip.Start("c :\Program Files\WinZip\wz zip.exe", args)
WinZip.WaitForE xit()
Do
If WinZip.HasExite d = True Then Exit Do
Loop
MsgBox("suppose dly exited")

However, it does not wait, and the message box never appears. I get
several command windows running WinZip at simultaneously. The program
does not block, If I click the button again, I get even more
simultaneously running command windows. But I can't get the program to
wait or even show me the messagebox.

Any ideas?

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #2
"Terry Olsen" <to******@hotma il.com> schrieb:
Dim WinZip As System.Diagnost ics.Process
Dim args As String = " -Pru -ex " & lblFolder.Text & "\" & PCName &
".zip @""" & appPth & "WksBkup.tx t"""
WinZip.Start("c :\Program Files\WinZip\wz zip.exe", args)
=> 'WinZip = Process.Start(. ..)'.
WinZip.WaitForE xit()
Do
If WinZip.HasExite d = True Then Exit Do
Loop
MsgBox("suppose dly exited")

However, it does not wait, and the message box never appears.


First, try to remove the 'Do...Loop' loop. As you are already using
'WaitForExit' the loop is not necessary.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
I added the Do...Loop just to see what would happen because the
'WaitForExit' is not waiting...

However, nothing is waiting and I can't figure out why...
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uJ******** *****@TK2MSFTNG P15.phx.gbl...
"Terry Olsen" <to******@hotma il.com> schrieb:
Dim WinZip As System.Diagnost ics.Process
Dim args As String = " -Pru -ex " & lblFolder.Text & "\" & PCName &
".zip @""" & appPth & "WksBkup.tx t"""
WinZip.Start("c :\Program Files\WinZip\wz zip.exe", args)


=> 'WinZip = Process.Start(. ..)'.
WinZip.WaitForE xit()
Do
If WinZip.HasExite d = True Then Exit Do
Loop
MsgBox("suppose dly exited")

However, it does not wait, and the message box never appears.


First, try to remove the 'Do...Loop' loop. As you are already using
'WaitForExit' the loop is not necessary.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
"Terry Olsen" <to******@hotma il.com> schrieb:
I added the Do...Loop just to see what would happen because the
'WaitForExit' is not waiting...

However, nothing is waiting and I can't figure out why...


Are you sure you made the other change I suggested?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #5

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

Similar topics

4
9418
by: Chang LI | last post by:
I tried to launch "python.exe test.py" in another program. After the launch the console was showed and exited on Windows. I want the console stay there. Is there a Python statement to wait an event loop like Tcl's "after forever"?
4
9892
by: Kartik | last post by:
Hi, I have an ASP.NET application using VB.NET.I am sending a DOS command to a machine on the network to print a file. This is achieved using xp_cmdshell Dim str As String = "xp_cmdshell ""type " & nwkfilepath & " > " & pPrinterName & " """
1
2682
by: xtra | last post by:
Hi Folk I have written a module that allows you to type a bunch of commands in the immediate window, for quick access to information when you are creating VB code. Here it is, it may be helpful to you (I find it pretty fast and friendly).... Some of it is specific to my database (I left out many as well which were too specific), so you will have to rewrite it for yours, but you may find it useful.... Any questions, please ask. Typing...
11
2929
by: Michi Henning | last post by:
Hi, I'm calling Monitor.Wait() from a console event handler. It's not working -- the call to Wait() immediately causes the process to exit. Is it impossible for some reason to call Wait() from an event handler? Small code example attached. Thanks,
5
3523
by: Kevin Hodgson | last post by:
I'm trying to launch a command line utility from my VB.NET App, In my function I create a process and launch the executable, and need to wait for it to exit, so that the calling code can move the output file to the userdata directory, if it's successful. The problem I'm having is that on myProcess.WaitForExit() I get a System.NullReferenceException, Object Reference not set to an instance of an object. Here's my function.
5
5600
by: Mark M | last post by:
I am attempting to use a third party command-line utility (WinDump.exe) to capture network traffic for perfromance analysis. This utility when launched captures network traffic until Ctrl-C is entered from the keyboard. I launch this utility (through a batch file) programmatically in a command-shell process through the Process object with no window (i.e. myProcess.StartInfo.CreateNoWindow = true). I have re-directed the StandardInput to a...
2
2661
by: semutmerah | last post by:
hi.. my english maybe wrong.. but hope somebody can understand me :) I did created 3 forms. "MainForm" , "CalForm" , "WaitForm". On "MainForm", I did put a command button called "Run". On "CalForm", there were some unbound "text box" which have some calculation
4
11096
by: Eddie | last post by:
I am opening a windows (well, technically a greybox() call GB_show() which shows a nicer window than normal), and want to wait until that window is closed before moving to the next command. However, when I open the window, JavaScript immediately issues the next command statement. How can I get JavaScript to wait until the window is closed before continuing? Here's visually what I'm trying to do: statement1; GB_show('mycaption,...
40
29334
by: =?Utf-8?B?Um9iZXJ0IEUuIEZsYWhlcnR5?= | last post by:
What is the C# command to wait for a specified period of time? I am writing a windows service that will process a file once it has beed created or changed. I'm using the fileSystemWatcher to detect when a specific file has been created or changed. That works fine to a point. The event does fire when the file is being created or changed but I then blow up when I attempt to open the file because the creation or changing has not...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.