ShellWait


Run an external program from within an LB program and wait until the program has finished before continuing the LB program.

filedialog "Open","*.txt",file$
if file$="" then end
SEEMASKNOCLOSEPROCESS = 64 '0x40
Struct s, cbSize as ulong, fMask as ulong, hwnd as ulong,_
lpVerb$ as ptr, lpFile$ as ptr, lpParameters$ as ptr ,_
lpDirectory$ as ptr, nShow as long, hInstApp as ulong,_
lpIDList as long, lpClass as long, hkeyClass as ulong,_
dwHotKey as ulong, hIcon as ulong, hProcess as ulong
s.cbSize.struct=len(s.struct)
s.fMask.struct=SEEMASKNOCLOSEPROCESS
s.hwnd.struct=0
s.lpVerb$.struct="Open"
s.lpFile$.struct=file$
s.lpParameters$.struct=""
s.lpDirectory$.struct=DefaultDir$
s.nShow.struct=_SW_RESTORE
calldll #shell32 , "ShellExecuteExA",s as struct,r as long
if r<>0 then
hProcess=s.hProcess.struct
else
print "Error."
end
end if
waitResult=-1
while waitResult<>0
calldll #kernel32, "WaitForSingleObject",_
hProcess as long,0 as long,_
waitResult as long
wend
print "Launched process has ended"
END


Home

Source Code

Utilities

Internet

Games

Graphics

Media Demos

Snippets

DLL's

API Resources

Freeware

LB 4 Companion

Mastering LB 3

LB Workshop

Game Workshop

Links

Index