Results 1 to 7 of 7

Thread: ShellAndWait

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 1999
    Location
    Ruinen, Drente, Netherlands
    Posts
    192
    Joacim,

    I am also using this code and it works fantastic !
    Ecxept I have some other problem:
    - When the Dos program is running and some other (windows) program is started, then the (shelled) Dos program is losing his focus and stops running. Is it possible the keep the Dos program running until it is ended ?
    (I am using it to send a fax from the Dos commandline and redirect the output to a file)

    with regards, Kars

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    I've never had that kind of trouble with the code. It might be the program you are shelling that couses this. Try e-mailing me the code you use and I see if I can come up with something.

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    I can't see any thing wrong with the code. BTW I didn't get any mail from you. You could try to e-mail me again and send the SSFAXER.EXE file.
    E-mail it to this address:

    [email protected]

    Best regards


  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Hmmm....

    How could my answer end up before your question?????

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 1999
    Location
    Ruinen, Drente, Netherlands
    Posts
    192

    ShellAndWait

    Joacim, here is the code that I am using, I have send you a e-mail but maybe you did not recieved it ?
    The DOS (fax)program 'SSFAXER.EXE' is the shelled program (I can send it to you).
    Regards, Kars Lensen

    'IN A FORM:
    Private Sub Form_Load()
    DOS$ = "C:\SSFAXER.EXE 2 T" 'Dos program
    FAX$ = "0123-123456 " 'Phone(fax)number
    FILE$ = "C:\Autoexec.bat" 'to send file
    List$ = " > c:\fax.lst" 're-direct file
    MsgBox DOS$ & FAX$ & FILE$ & List$

    'make a batch-file
    iFile = FreeFile
    Open "C:\fax.bat" For Output As iFile
    Print #iFile, DOS$ & FAX$ & FILE$ & List$
    Close #iFile

    Dim sCmd As String
    sCmd = Environ("COMSPEC") & " /C "
    sCmd = sCmd & "c:\fax.bat"
    ShellAndWait sCmd, vbNormalFocus 'vbHide

    End Sub

  6. #6
    Lively Member
    Join Date
    May 2000
    Location
    Atlanta, GA
    Posts
    80

    Question ShellAndWait not returning focus

    I am running the ShellAndWait (like in the posted msgs) to execute a BAT file. My VB app never gets focus returned to it after the BAT file has finished processing. I am executing the BAT file using the Environ("COMSPEC") & " /C " line...

    Any ideas?

    Thanks!
    Kevin

  7. #7
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Try calling AppActivate after the call to ShellAndWait.

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