SilverLong专栏

程序员的命运

使用API获取一个应用是否运行结束的例子

下面是在PB程序中调用一个BAT批处理文件,然后等待它执行完成。
li_FileNum = FileOpen( "C:/Temp/busy.$$$", LineMode!, Write!, LockWrite!, Replace! )
FileWrite(li_FileNum, "Busy as usual.")
FileClose(li_FileNum)

// Batch file starts successful?
If (Run("run.bat arg1 arg2", Minimized!) = 1) Then
// Yes, batch file started successfully;
// Wait for batch file to finish
Do While (FileExists("C:/Temp/busy.$$$"))
SetPointer(HourGlass!)
Yield()
Loop
End If

The batch file 'run.bat' typically will contain something like:

@echo off
REM --- run.bat --------------
REM function: Do your thing
REM args: - %1: argument 1
REM - %2: argument 2

REM Do your thing here

del C:/Temp/busy.$$$

 

转载:http://www.pdriver.com/display.asp?key_id=1098

阅读更多
文章标签: api file function c
个人分类: PowerBuild
上一篇脚本实现CheckBox父选中,子全选中,子选中父也选中!
下一篇一些有用的Windows Shell对象库(已经封装为用户对象)
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭