如何在exe中运行bat,并在运行完bat后再执行exe中的代码
3fly 2003-06-03 05:08:13 我想用如下方法,却不行
#########################################
var
h: cardinal;
hd: HDC;
begin
showmessage('start...');
h := ShellExecute(Application.Handle, 'open',
'C:\test.bat',
nil,
nil,
SW_shownormal);
WaitForInputIdle(h, INFINITE);
showmessage('end...');
end;
######################################
可是WaitForInputIdle在dos窗口打开时就执行完了,而不是在bat中的dos命令运行完后(或dos窗口关闭后)执行完的,请教……