这个程序怎么写 
Shell 一个程序文件,如果shell不成功就不断shell 直至成功为止. 谢谢!

解决方案 »

  1.   

    dim dwProcessId as long
    dwProcessId = shell("notepad.exe")
    do while dwProcessId=0
       dwProcessId = shell("notepad.exe")
       doevents
    loop
      

  2.   

    这种需求好像可能性不大吧
    如果一定要不断的尝试执行某个程序 最好加个sleep函数 要不你的cpu资源会被大量占用
    而且执行失败会有错误信息 所以还要加on error语句
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Private Sub Command1_Click()
    Dim dwProcessId As Long
    Static a As Long
    On Error Resume Next
    Do While dwProcessId = 0
      Err.Clear
      dwProcessId = Shell("e:\1.exe", vbNormalFocus)
      DoEvents
      a = a + 1
      Sleep 100
    Loop
    Print dwProcessId
    End Sub
      

  3.   

    接分
    是不是要加点sleep之类的延迟还有退出机制呀,不然恐怕会死机了