Close process

Blitz3D Forums/Blitz3D Programming/Close process

By the time the calculator is executed, the handle is allready read and returned zero, so use a while..wend to wait for the calculator to appear.
;------------------------decls
;.lib "user32.dll"
;api_FindWindow% (lpClassName%, lpWindowName$) : "FindWindowA"
;api_CloseWindow% (hwnd%) : "CloseWindow"
;------------------------------------------------------

ExecFile "Calc.exe"

find = 0
While find = 0
	find = api_FindWindow(0, "Calculator")
Wend

Input "Press enter to close"

api_CloseWindow(find)

RuntimeError "Ok!"