http://book.51cto.com/art/201202/316588.htm
WinExec()
需要说明的是,该命令的执行时间取决于命令本身的执行时间,如果命令执行需要很长时
间,则程序表面看上去会像“死掉”状态,为了避免这种情况,可以在其他线程中调用
GetMessage函数使之停止。
MSDN上的說明
http://msdn.microsoft.com/zh-tw/library/windows/desktop/ms687393(v=vs.85).aspx
The WinExec function returns when the started process calls the GetMessage
function or a time-out limit is reached. To avoid waiting for the time out
delay, call the GetMessage function as soon as possible in any process
started by a call to WinExec.
也就是說,如果開啟的程式沒有Call到GetMessage,那原本的父程序就會卡在WinExec()
這行,直到子 process time-out 或是有執行到GetMessage。
而ShellExecute,CreateProcess則是開啟後就不會等子 process
詳見這個討論串
http://bbs.csdn.net/topics/60177539
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.251.162.86
※ 編輯: water2924 來自: 111.251.162.86 (12/27 12:57)