473,387 Members | 1,290 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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" .....

Jun 26 '07 #1
3 1301
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()

<le*******@hotmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.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" .....

Jun 26 '07 #2

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

Jun 26 '07 #3
This is the VB.NET newsgroup. microsoft.public.vb.* would be what you are
after.

<le*******@hotmail.comwrote in message
news:11**********************@n60g2000hse.googlegr oups.com...
>
I'm sorry, but I mean how to do that in vb6.
Jun 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Yoni Rabinovitch | last post by:
Is it possible to invoke a C# delegate/event handler asynchronously, from unmanaged C++ ? I assume this requires a Managed C++ wrapper, which would call BeginInvoke on the delegate ? Is this...
3
by: David Logan | last post by:
I have an application using sockets, and it uses the asynchronous method for receiving (and others, but receiving is the basic problem.) In short, I want: class someClass: Form {...
11
by: Yoni Rabinovitch | last post by:
Is it possible to invoke a C# delegate/event handler asynchronously, from unmanaged C++ ? I assume this requires a Managed C++ wrapper, which would call BeginInvoke on the delegate ? Is this...
23
by: Thomas Due | last post by:
Hi, I have a class which monitors a TCP socket. This will on occasion raise an event which can be handled by a GUI. Now, I am aware of the if(InvokeRequire) { EventHandler d = new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.