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

推荐订阅源

IT之家
IT之家
C
CXSECURITY Database RSS Feed - CXSecurity.com
V
Visual Studio Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
小众软件
小众软件
L
LangChain Blog
Cyberwarzone
Cyberwarzone
美团技术团队
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
V
V2EX
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
L
LINUX DO - 最新话题
Recent Announcements
Recent Announcements
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
aimingoo的专栏
aimingoo的专栏
人人都是产品经理
人人都是产品经理
F
Full Disclosure
V2EX - 技术
V2EX - 技术
The Cloudflare Blog
博客园 - 叶小钗
T
Threat Research - Cisco Blogs
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Latest news
Latest news
S
Security @ Cisco Blogs
Spread Privacy
Spread Privacy
Project Zero
Project Zero
K
Kaspersky official blog
MyScale Blog
MyScale Blog
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
博客园 - 【当耐特】
Hacker News - Newest:
Hacker News - Newest: "LLM"
大猫的无限游戏
大猫的无限游戏
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Webroot Blog
Webroot Blog
罗磊的独立博客
Vercel News
Vercel News
N
News and Events Feed by Topic
A
Arctic Wolf
C
CERT Recently Published Vulnerability Notes

博客园 - 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!