当前位置: 代码迷 >> VFP >> 怎么结束所有Word进程再继续运行
  详细解决方案

怎么结束所有Word进程再继续运行

热度:5013   发布时间:2013-02-26 00:00:00.0
如何结束所有Word进程再继续运行
我用以下码结束Word程序, 问题是Word没成功结束,就继续执行后面的程序了,造成出错.
Declare Integer WinExec in kernel32 string, integer 
MyCommand="TASKKILL /F /IM WINWORD.exe"
= WinExec (MyCommand,0) 
Clear Dlls 

怎么写代码才能做到"直到结束了所有的Word进程再继续执行后面的代码"?(可能有多个word进程)


------解决方案--------------------------------------------------------
C# code
Declare Integer WinExec In kernel32 String, Integerm.llExist = .T.Do While m.llExist  Try    m.loWord = Getobject(,'Word.Application')    m.loWord = Null    m.llExist = .T.    * 你结束 Word 的代码  Catch    m.llExist = .F.  EndtryEnddo* 继续执行你的程序
  相关解决方案