惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - gyhanonline

Function Point in Vbscript Simulate click event using widows API. Static Constructor A Go Set program A Go Set program About Inherit Code for Inter-process communicate Integrity Level Test for publish blog by word 2007 托管为什么安全 The usage of intellisense in Vs .net 2005 我的面试(七) 关于singlton的一些问题 我的面试(六) 我的面试(五) 我的面试(四)补充1 我的面试(四) 我的面试(三) 我的面试(二)
Window API in QTP
gyhanonline · 2010-05-01 · via 博客园 - gyhanonline

In my previous post, I talk about How to use windows API send click message to an “ok” button of IE alert dialog. The code used c#. I’d like to transmit them to QTP. It’ll more stable and efficient than QTP built-in Function.

In QTP, if we want to do some action on a dialog, we should add a dialog object to repository.QTP can use their properties to find the dialog then execute command. But the problem is that some dialog’s properties are dynamic. Such as the title of Download Dialog.It lead to QTP couldn’t find exactly object. That’s why our automation script sometimes is slow and broken.

To avoid these tricky, QTP provide us external object. It can be used to call external function. Windows API is good experience. We can use Windows API in QTP. It’s terrific, right? We can using API do everything efficiently.

Following is the script segment to click “OK” button of IE pop dialog.

extern.Declare micHwnd,"FindWindowEx", "user32.dll","FindWindowEx",micHwnd,micHwnd,micString,micString

extern.Declare micLong, "PostMessage", "user32.dll", "PostMessageA", micHwnd, micLong, micLong, micLong

extern.Declare micHwnd,"SetActiveWindow","user32.dll","SetActiveWindow",micHwnd

extern.Declare micInteger,"SetForegroundWindow","user32.dll","SetForegroundWindow",micHwnd

hwndP = extern.FindWindowEx (0,0,"#32770", null)

hwndButton = extern.FindWindowEx (hwndP,0,"Button","OK")

extern.SetForegroundWindow hwndP

extern.SetActiveWindow hwndP

extern.PostMessage hwndButton,&H0F5,0,0

Enjoy QTP; enjoy your auto-life!