处理waitforexit不等待资源管理器关闭 [英] Process waitforexit not waiting for explorer to close

查看:125
本文介绍了处理waitforexit不等待资源管理器关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在尝试打开W​​indows资源管理器,然后等待用户关闭此应用程序,然后再继续我的程序。



该程序与记事本一样,但不是资源管理器。



谢谢



我尝试过:



Hi,

I am trying to open Windows Explorer and then wait for the user to close this application, before continuing with my program.

The program works as intended with Notepad, but not Explorer.

Thanks

What I have tried:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim newProc As Diagnostics.Process
        'newProc = Diagnostics.Process.Start("Notepad.exe") ' This Works
        newProc = Diagnostics.Process.Start("Explorer.exe") ' This does not work
        newProc.WaitForExit()
        MsgBox("Continue Processing")
    End Sub

推荐答案

这是因为Explorer只会启动一次并在用户登录控制台的整个时间内保持运行状态。当您启动Explorer实例时,您并没有真正启动名为Explorer.exe的新进程。您告诉现有的Explorer实例打开新窗口。
That's because Explorer only ever launches once and stays running the entire time the user is logged in at the console. When you launched your instance of Explorer, you didn't really launch a new process called "Explorer.exe". You told the existing Explorer instance to open your new window.


这篇关于处理waitforexit不等待资源管理器关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆