PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET invoke a function synchronously

Reply

invoke a function synchronously

 
Thread Tools Rate Thread
Old 26-06-2007, 04:36 AM   #1
leochen76@hotmail.com
Guest
 
Posts: n/a
Default invoke a function synchronously


Hi,

I have a procedure that executes an external vbscript file using
ShellExecute as listed below.
Immediately after that, I will read whatever in a text file which
is the output of that vbscript file.

The problem is that the vbscript file is executed asynchronously,
and I always end up opening an empty text file because the vbscript
file is still running. How can I wait until the vbscript is done?
Thanks a lot.

Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" .....

  Reply With Quote
Old 26-06-2007, 05:57 AM   #2
Ray Cassick
Guest
 
Posts: n/a
Default Re: invoke a function synchronously

Take a look intothe Process.Start method.

mProcess = New Process

With mProcess.StartInfo

.FileName = ("file.exe")

.Arguments = commandLineArgs

.UseShellExecute = False

.CreateNoWindow = True

End With

mProcess.Start()

mProcess.WaitForExit()





<leochen76@hotmail.com> wrote in message
news:1182829003.151644.144580@k79g2000hse.googlegroups.com...
> Hi,
>
> I have a procedure that executes an external vbscript file using
> ShellExecute as listed below.
> Immediately after that, I will read whatever in a text file which
> is the output of that vbscript file.
>
> The problem is that the vbscript file is executed asynchronously,
> and I always end up opening an empty text file because the vbscript
> file is still running. How can I wait until the vbscript is done?
> Thanks a lot.
>
> Private Declare Function ShellExecute Lib "shell32.dll" Alias
> "ShellExecuteA" .....
>



  Reply With Quote
Old 27-06-2007, 12:38 AM   #3
leochen76@hotmail.com
Guest
 
Posts: n/a
Default Re: invoke a function synchronously


I'm sorry, but I mean how to do that in vb6.

  Reply With Quote
Old 27-06-2007, 12:45 AM   #4
Luke R
Guest
 
Posts: n/a
Default Re: invoke a function synchronously

This is the VB.NET newsgroup. microsoft.public.vb.* would be what you are
after.

<leochen76@hotmail.com> wrote in message
news:1182901099.674847.264990@n60g2000hse.googlegroups.com...
>
> I'm sorry, but I mean how to do that in vb6.
>


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off