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")

 

 

 

问题:

bubuko.com,布布扣

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!