In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
VB.NET monitors the specific steps of the startup process, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
You may not be unfamiliar with the implementation of the VB.NET startup process, because this operation skill is relatively basic, and beginners should be exposed to it in the process of learning. So how to correctly implement VB.NET to monitor the startup process? The answer will be found here.
After starting this process, the code in the parent program can continue to execute. You need some ways to monitor the processes that are started and find out when they exit or if they are still running. Depending on your application, you may need to deal with this problem in different ways.
Start the process and stop your program until it exits.
Start the process, monitor it, and do something only when it's over, while keeping your program running properly.
Start the process, give it some input, let it process the input, and then force it to exit.
Start the process and perform some actions as long as the startup process is running or there are no problems during the run. If the process exits or stops, you need to do something.
Start the process, give it some special inputs, and / or obtain the output from further processing. For example, you might want to start a command window, enter something in that window programmatically, and then get and process the output.
Start a process and wait until it exits
The Process.WaitForExit method is called while waiting for the simplest method of an initiated process to finish. This causes the process being started to stop execution until the started process exits. Unfortunately, when you use this method directly from a Windows form, it can also cause the form to stop responding to system events, such as Paint.
So generally speaking, you don't want to use the WaitForExit method from a button to start an external program (although using the WaitForExit method is ideal for starting another process from an application that does not have a visual user interface, such as calling a console application from an ASP.net application server). The sample form has a button called "Launch and WaitForExit" that allows you to see what happens when you use this method from a form.
VB.NET monitoring startup process code example:
Private Sub btnWaitForExit_Click (_
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnWaitForExit.Click
'create a new procedure
Dim myProcess As Process = _
System.Diagnostics.Process.
Start ("sample.txt")
Wait until it exits
MyProcess.WaitForExit ()
'Show the result
MessageBox.Show ("Notepad"
Was closed at: "& _
MyProcess.ExitTime & "." & _
System.Environment.NewLine
& "Exit Code:" & _
MyProcess.ExitCode)
MyProcess.Close ()
End Sub
The previous example illustrates an interesting situation. Even after the startup process is over, you still have the ability to access the Process object in the code; in this case, however, most of the Process properties are not available because the procedure itself no longer exists. You can still read the ExitCode and ExitTime properties, which return integer and date-time values, respectively. The DOS command sets an exit code to let you know if there is an error.
.net and other Windows applications can set this value by using the return value of the main method. By default, this value equals zero. For the DOS command, a non-zero ExitCode value either indicates an error or indicates that the command process was aborted abnormally.
After reading the above, have you mastered the specific steps of VB.NET to monitor the startup process? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.