Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Running WB from VB

Keywords:   launching Winbatch from Visual Basic

I use one methods that always seems to work.

I use the WaitForSingleObject, OpenProcess and CloseHandle API's which are in Kernel32.

First you get a windows handle from the Shell to WinBatch, e.g. :

	iPid=Shell("c:\Winbatch\Winbatch.exe c:\winbatch\execxxx.wbt",0)
Then get the NT process id by using:
	iprocesshandle=OpenProcess(SYNCHRONIZE,0,iPid)
then isuue a call to WaitForSingleObject(iprocesshandle,INFINITE)

VB will sit and wait until process id iprocesshandle has completed.

Finally issue a CloseHandle(iprocesshandle)

Works every time.


Article ID:   W14373
Filename:   Running WB from VB.txt