就是这样的,点击一个按钮,运行一个程序a。当这个运行的程序a自动关闭的时候,会自动弹出一个提示框,告知a已经关闭啦,。
------解决方案--------------------------------------------------------
用简单枚举进程方法如:
LOCAL oWbemLocator,oWMIService, oItems, oItem
oWbemLocator = CREATEOBJECT("WbemScripting.SWbemLocator")
oWMIService = oWbemLocator.ConnectServer(".", "root/cimv2")
oItems = oWMIService.ExecQuery("SELECT * FROM Win32_Process")
FOR EACH oItem IN oItems
MAJC=LOWER(oItem.Name)
IF MAJC='某某进程.exe'
.......
ENDIF
ENDFOR
如果该程序有固定标题,也可以这样
------解决方案--------------------------------------------------------
不好意思,按错了键:
DECLARE INTEGER FindWindow IN user32 STRING lpClassName,STRING lpWindowName
IF FindWindow(NULL,'某某标题')=0
.........
endif
------解决方案--------------------------------------------------------
- C/C++ code
Declare integer CreateToolhelp32Snapshot in win32api integer,integerDeclare integer Process32First in win32api integer,string @Declare integer Process32Next in win32api integer,string @Declare integer CloseHandle in win32api integerCLEARlnHand = 0lnHand = CreateToolhelp32Snapshot(3,0)If lnHand>0 lctitle=SPACE(256) If Process32First(lnHand,@lctitle) > 0 tln = 0 Do while Process32Next(lnHand,@lctitle)> 0 m.lnval=SUBSTR(lctitle,37,256) m.lnval=left(m.lnval,At(Chr(0),m.lnval) - 1) If Lower(m.lnval) == 'excel.exe' tln = tln + 1 If tln == 1 Exit Endif Endif Enddo If tln == 0 Messagebox("程序已经被关闭",4096,"Message") CloseHandle(lnHand) Clear Dlls Else ****没有关闭 Endif Endif CloseHandle(lnHand)Endif
------解决方案--------------------------------------------------------
ox=CreateObject("WScript.Shell")
ox.Run("notepad.exe",1,1) && 第3个参数1,表示一直等待被调用的程序。notepad.exe 为调用的记事本程序
MessageBox('程序已关闭',64,'信息提示')
Release ox