问题描述
比如一个WinRAR进程在运行,该如何判断WinRAR进程是否结束,若WinRAR不结束则等待,直到WinRAR进程结束才继续下面的操作。谢谢
解决方案
解决方案二:
顶
解决方案三:
System.Diagnostics.Processp=newSystem.Diagnostics.Process();p.StartInfo.FileName="mspaint";p.Start();p.WaitForExit();MessageBox.Show("");
解决方案四:
namespaceFileSystemWatcherExample{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoidbutton1_Click(objectsender,EventArgse){//CreateanewFileSystemWatcherandsetitsproperties.FileSystemWatcherwatcher=newFileSystemWatcher();watcher.Path="E:\Project\C#组件熟悉\窗体控件\FileSystemWatcherExample";/*WatchforchangesinLastAccessandLastWritetimes,andtherenamingoffilesordirectories.*/watcher.NotifyFilter=NotifyFilters.LastAccess|NotifyFilters.LastWrite|NotifyFilters.FileName|NotifyFilters.DirectoryName;//Onlywatchtextfiles.watcher.Filter="test.txt";//Addeventhandlers.watcher.Changed+=newFileSystemEventHandler(OnChanged);watcher.Created+=newFileSystemEventHandler(OnChanged);watcher.Deleted+=newFileSystemEventHandler(OnChanged);watcher.Renamed+=newRenamedEventHandler(OnRenamed);//Beginwatching.watcher.EnableRaisingEvents=true;//Waitfortheusertoquittheprogram.}//Definetheeventhandlers.privatestaticvoidOnChanged(objectsource,FileSystemEventArgse){//Specifywhatisdonewhenafileischanged,created,ordeleted.MessageBox.Show("File:"+e.FullPath+""+e.ChangeType);}privatestaticvoidOnRenamed(objectsource,RenamedEventArgse){//Specifywhatisdonewhenafileisrenamed.MessageBox.Show("File:"+e.OldFullPath+"renamedto"+e.FullPath);}}}
解决方案五:
sign