编辑: ZCYTheFirst 2012-12-15

5 seconds, QuickTest terminates the process. 注意:执行该语句时,QuickTest 首先向进程窗口发送一个 WM_CLOSE 信息,偿试关闭该进程;

如果该进程在

5 秒钟后存未 关闭,则QuickTest 强制结束进程. Example Close an Application According to its Process ID 下面的例子通过 GetRoProperty 方法获取 Notepad 窗口的 PID 值,然后使用 CloseProcessById 方法关闭 Notepad 程序. Sub CloseProcessById_Example() PID = Window( Notepad ).GetROProperty( process id ) SystemUtil.CloseProcessById (PID) End Sub CloseProcessByName Method Description Closes a process according to its name. Syntax object.CloseProcessByName (bsProcessName) Argument Description object A test object of type SystemUtil. SystemUtil 类型的测试对象. bsProcessName Required. A String value. The name of the process you want to close. 必须.一个字符串值. 你想关闭的进程的名称. Return Value A Long value. The number of instances of the application that are closed when the statement runs. 一个 Long 值.所关闭的程序的实例数. Remarks Note: QuickTest initially tries to close the process by sending a WM_CLOSE message to the process window. If the process is still open after

5 seconds, QuickTest terminates the process. 注意:执行该语句时,QuickTest 首先向进程窗口发送一个 WM_CLOSE 信息,偿试关闭该进程;

如果该进程在

5 秒钟后存未 关闭,则QuickTest 强制结束进程. Example Close All Instances of a Specified Application 本例通过 CloseProcessByName 方法,关闭所有已打开的 Notepad 实例.如果当前所有的 Notepad 实例都是由下面的 Run 语句打开的,则CloseProcessByName 方法语句会关闭这些实例,并且 MsgBox 窗口显示的数值应为

3 . Sub CloseProcessByName_Example() SystemUtil.Run Notepad.exe SystemUtil.Run Notepad.exe SystemUtil.Run Notepad.exe MsgBox SystemUtil.CloseProcessByName( Notepad.exe ) End Sub CloseProcessByWndTitle Method Description Closes all processes that are owners of windows with the specified title. 关闭指定窗口标题的所有进程. Syntax object.CloseProcessByWndTitle (bsTitle, [bRegExp]) Argument Description object A test object of type SystemUtil. SystemUtil 类型的测试对象. bsTitle Required. A String value. The title of the window owned by the process you want to close. 必须.一个字符串值. 你想关闭的进程的窗口的标题. bRegExp Optional. A Boolean value. Indicates whether the bsTitle argument is treated as a regular expression. Default = False. 可选.一个 Boolean 值. 检查 BsTitle 参数是否是一个正则表达式.默认值为 False. Return Value A Long value. The number of instances of the application that are closed when the statement runs. 一个 Long 值.被语句所关闭的程序的实例数. Remarks Note: QuickTest initially tries to close the process by sending a WM_CLOSE message to the process window. If the process is still open after

5 seconds, QuickTest terminates the process. 注意:执行该语句时,QuickTest 首先向进程窗口发送一个 WM_CLOSE 信息,偿试关闭该进程;

如果该进程在

5 秒钟后存未 关闭,则QuickTest 强制结束进程. Example Close All Windows with a Title Containing a Specified String 本例关闭了所有的标题包含有 Notepad 字样的顶层窗口.因为 bRegExp 参数值为 ture ,表示 bsTitle 值是一个正则表 达式. Sub CloseProcessByWndTitle_Example1() SystemUtil.CloseProcessByWndTitle Notepad , True End Sub Close All Windows in which the Exact Title Matches a Specified String 本例关闭所有窗口标题为 Untitled-Notepad 的顶层窗口.因为 bRegExp 参数值为 false ,表示 bsTitle 参数值是一个文 字串,因此窗口标题必须与参数值精确匹配. Sub CloseProcessByWndTitle_Example2() SystemUtil.CloseProcessByWndTitle Untitled - Notepad End Sub Run Method Description Runs a file or application. 运行一个文件或应用程序. Syntax object.Run file, [params], [dir], [op], [mode] Argument Description object A test object of type SystemUtil. SystemUtil 类型的测试对象. file Required. A String value. The name of the file you want to run. 必须.一个字符串值. 你想要运行的文件的名称. params Optional. A String value. If the specified file argument is an executable file, use the params argument to specify any parameters to be passed to the application. 可选.一个字符串值. 如果 file 参数中指定的是一个可执行文件, 则可以使用 params 参数来指定该可执行文件的运行参数. dir Optional. A String value. The def........

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题