VB & Shelling

vb6 Mexico
  • 13 years ago

     Is there a way to output data to a running shell.

     e.g.

    Shell("cmd myBatch.bat")

    Then once its finished working through the batch file write a message to the shell.... I know how to retrieve the handle of the shell and then use that to close the shell but cant think of a way to output a message.

    Any help would be much appreciated, thanks
     

  • 13 years ago

    If you can get the handle of the shelled window, you can make it the active window.

    If you do that, you can probably simply use SendKeys() to type into it...

  • 13 years ago
    hi i dont know what exactly is in your .bat file. and i could not understand what type of message you want to output i.e. whether thought msgbox or some other way. but i would like make following suggestion. probably it wont help you directly. you can devise some other logic. shell "cmd mybatch.bat > new.txt" this wil save the output of .bat file into new.txt file. now you can read the new.txt line by line (or word by word) and decide accordingly. regards manpreet singh dhillon hoshiarpur
  • 13 years ago

    Thanks for the quick replys.

    Manpreet Im not really looking to use a msgbox because that would involve user interaction and an output file would defeat the purpose.

    Basically my program doesn't actually use a batch file (it was just a simple example) my program has the ability to run silently without the need for user interaction but I produce a shell at the beginning to let the user know that its running I wanted to update that shell with information about how far along the program is at the moment (ie what its doing currently).

    Jef not to sure if SendKeys() will let me do what I want, but I haven't tried it will try that now and let you know.

     Thanks again
     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry