QTP实例代码
时间:2014-10-28 17:42:27
收藏:0
阅读:176
实例代码:
‘声明FindWindow方法,调用user32.dll中的FindWindowA函数
Extern.Declare.micHwnd,"FindWindow","user32.dll","FindWindowA",micString,micString
‘声明SetWindowText方法
Extern.Declare miclog,"SetWindowText","user32.dll","SetWindowTextA",micHwnd,micString
‘获取记事本的窗口的句柄
hwnd = Extern.FindWindow("Notepad",vbNullString)
If hwnd = 0 Then
MsgBox"未能找到记事本窗口"
End If
‘改变记事本窗口的标题
res = Extern.SetWindowText(hwnd,"Hello
world")
问题:
评论(0)