Results 1 to 5 of 5

Thread: Closeing Pid??

  1. #1

    Thread Starter
    Addicted Member Tiovital's Avatar
    Join Date
    Apr 2000
    Posts
    249
    I'm Running a DOS Appl which I have in vbHide and i am redirecting the output to a file.
    ExecHandle = Shell(BatFile, vbHide) ' run the bat

    1) How colud i know if my bat file is finished executing ?? ( i want to read the output).
    2) How do i close Dos appl??

    Best Regards



  2. #2
    Lively Member
    Join Date
    Jun 2000
    Location
    Belgium
    Posts
    77
    1. At the end of your bat, create a file (like Finish.txt)
    In your app, test the existence of this file. When it existe, you know that the app has finish. (don't forget to delete this file before the next call to the Dos app)

    2. I working on..
    KWell

  3. #3
    Lively Member
    Join Date
    Jun 2000
    Location
    Belgium
    Posts
    77
    1. see up
    2. maybe in using the senkey but i don't know if it work because the app is hiden
    Code:
    ExecHandle = Shell(BatFile, vbHide)
     
    '
    ' Wait the finishing of the Dos App
    '
    
    AppActivate ExecHandle
    SendKeys "%{F4}", True
    KWell

  4. #4
    Lively Member
    Join Date
    Jun 2000
    Location
    Belgium
    Posts
    77

    Smile

    Another way

    Code:
    Global Const SW_SHOWNORMAL = 1
    
    Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    
    Sub MyProc()
    
     ' 
     '
     
     ExecHandle = Shell(BatFile, vbHide) ' run the bat 
     
     '
     ' Waiting the end of the Dos App
     '
     
     ' Show the Dos window
     ShowWindow ExecHandle, SW_SHOWNORMAL
     
     ' Active the Dos window
     AppActivate ExecHandle
     ' Close the Dos window (send Alt-F4) 
     SendKeys "%{F4}", True   
     
     '
     '
     '
    End Sub
    KWell

  5. #5

    Thread Starter
    Addicted Member Tiovital's Avatar
    Join Date
    Apr 2000
    Posts
    249
    KWell - Thanks, I will try it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width