How to make Shell() function synchronous ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ppuniversal
    New Member
    • Feb 2007
    • 52

    How to make Shell() function synchronous ?

    Hi everyone,
    I am making using Shell() function to run a command line tool from my VB Application.

    I am using it to archive a folder. So I am using the code :
    Code:
    Shell("command line argument as string")
    where "command line argument as string" is the DOS command for the particular command line zip tool.

    The command is properly working but when the number of files are more in the folder, then the time taken to archive is more than some milliseconds or even more than some seconds.

    Now the problem is that : I FTP this file to a FTP Server. But if the time taken to archive the folder is more then my execution of code reaches the FTP part and at that time it does not fine any .ZIP file in the specified location. Thus it fails to FTP the file.

    One solution to this problem is to provide some delay after calling the Shell() function. But this does not provide a guaranteed time for all cases.

    So I am searching for a way that I make this Shell() function synchronous (As it is Asynchronous by default, as they say in MSDN). In MSDN they say to include an Optional argument "True" to make it synchronous, but it is not working.

    I am using VB6.

    Please provide me with a way for this issue.

    Thanks in advance
    Pawan
    Last edited by ppuniversal; Oct 14 '07, 04:02 PM. Reason: To provide the VB version
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Try seaching here for ShellExecute.

    Comment

    • ppuniversal
      New Member
      • Feb 2007
      • 52

      #3
      Thanks
      But I found the ShellandWait code when I searched google for Shell + Wait. It solved my issue, the way I wanted.
      Pawan

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by ppuniversal
        But I found the ShellandWait code when I searched google for Shell + Wait. It solved my issue, the way I wanted.
        ShellandWait? Never heard of it.

        Comment

        Working...