(转) 启动应用程序的方式
上一篇 /
下一篇 2008-12-20 12:13:47
/ 个人分类:QTP
常用的启动应用程序的方式
'1.systemutil.Run
SystemUtil.Run "calc.exe"
'2.wscrīpt.shell
Dim wsh 'as wcript.Shell
Dim strExe_Path 'as string
strExe_Path = "calc.exe"
Set wsh=CreateObject("wscrīpt.shell")
wsh.Exec strExe_Path
Set wsh=nothing
'3.录制的方式,虽然比较傻,但是很有效
Dialog("运行").WinEdit("打开(O):").Set "calc.exe"
Dialog("运行").WinButton("确定").Click
SystemUtil.Run "calc.exe","","C:\Documents and Settings\piaochunlong",""
Window("计算器").Close
'4 api方式 难度在于了解win32消息机制
'vb api变换成 QTP的api声明才能用
'Public Declare Function WinExec Lib "kernel32" Alias "WinExec" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long
Extern.Declare micLong,"WinExec","kernel32","WinExec",micString,micLong
Extern.WinExec "calc.exe",5
备注:针对最后一种情况提供一个声明转换的工具。
'5InvokeApplication
InvokeApplication "calc.exe"
收藏
举报
TAG: