Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
12Activity
×
0 of .
Results for:
No results containing your search query
P. 1
Scripting QTP - CH13 - Win32API

Scripting QTP - CH13 - Win32API

Ratings:

4.5

(2)
|Views: 1,882|Likes:
Published by Rajesh Kumar

More info:

Published by: Rajesh Kumar on Jul 08, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See More
See less

08/19/2010

pdf

text

original

 
Chapter 13 Scripting Quicktest Professional Page 1
Dani Vainstein Win32API Page 1 of 22
WINDOWS 32 API...................................................................................................................1
 
W
HAT IS
API?........................................................................................................................2
 
D
ESIGN
M
ODELS
............................................................................................................... 2
 
ELEASE
P
OLICIES
............................................................................................................ 3
 
API
 
E
XAMPLES
................................................................................................................. 3
 
T
HE
W
INDOWS
API...............................................................................................................4
 
DLL
 
(D
YNAMIC
L
INK 
L
IBRARY
)
 
F
ILES
.................................................................................4
 
F
UNDAMENTALS OF A
DLL....................................................................................................4
 
B
ACKGROUND
........................................................................................................................5
 
H
ISTORY
................................................................................................................................5
 
W
INDOWS
M
ESSAGES
............................................................................................................6
 
W
INDOWS
H
ANDLES
..............................................................................................................7
 
O
VERVIEW OF THE
W
INDOWS
API
 
C
OMPONENTS
................................................................7
 
B
ASE
S
ERVICES
................................................................................................................ 7
 
G
RAPHICS
D
EVICE
I
 NTERFACE
.......................................................................................... 7
 
U
SER 
I
 NTERFACE
.............................................................................................................. 8
 
C
OMMON
D
IALOG
B
OX
L
IBRARY
...................................................................................... 8
 
C
OMMON
C
ONTROL
L
IBRARY
........................................................................................... 8
 
W
INDOWS
S
HELL
.............................................................................................................. 8
 
 N
ETWORK 
S
ERVICES
......................................................................................................... 9
 
W
EB
API
S
......................................................................................................................... 9
 
M
ULTIMEDIA RELATED
API
S
............................................................................................ 9
 
API
S FOR INTERACTION BETWEEN PROGRAMS
................................................................. 10
 
W
INDOWS
API
 
T
OOLS
.........................................................................................................11
 
API
 
V
IEWER 
................................................................................................................... 11
 
T
HE
E
XTERN
O
BJECT
..........................................................................................................12
 
L
IMITATIONS USING THE
E
XTERN
O
BJECT
....................................................................... 12
 
C
ONVERTING TO
E
XTERN
.D
ECLARE
................................................................................ 13
 
Example 1: GetPrivateProfileString Function............................................................... 13
 
Example 2: GetServiceKeyName Function................................................................... 15
 
H
IGHLIGHTS FOR 
W
IN
32
 
API
IN
Q
UICK 
T
EST
................................................................... 17
 
Passing Parameters to Win32 API functions................................................................. 18
 
Callback Functions....................................................................................................... 19
 
Interacting with a custom dll file.................................................................................. 19
 
T
HE
E
XTERN
O
BJECT
........................................................
E
RROR 
!
 
B
OOKMARK NOT DEFINED
.
 
A
PPENDIX
13.A....................................................................................................................19
 
Declare Data Types...................................................................................................... 22
 
Windows 32 API
This tutorial is about how to add additional functionality to your applications byusing the Windows Advanced Programming Interface.
Windows
 
API
(
A
pplication
P
rogramming
I
nterfaces)is a set of predefinedWindows functions used to control the appearance and behavior of every Windowselement (from the outlook of the desktop window to the allocation of memory for anew process). Every user action causes the execution of several or more
API
 
 
Chapter 13 Scripting Quicktest Professional Page 2
Dani Vainstein Win32API Page 2 of 22
function telling Windows what's happened.It is something like the native code of 
Windows
. Other languages just act as ashell to provide an automated and easier way to access
APIs
.
QuickTest
supports a
VBScript
development language and its functionality canbe extended in two ways. The first way, is by using custom controls. These aresoftware components that are easily incorporated into
QTP/VBS
scripts. There arecustom controls for almost any task imaginable, including numerical analysis,speech recognition, image and document support. Custom controls are calledOcx’s.The second way,
QuickTest
can be extended is through the
Windows
ApplicationProgramming Interface (
API
), using the
Extern object
.
API
functions are notsupported in
VBSript
.
What is API?
An application programming interface (
API
) is a source code interface that acomputer system or program library provides in order to support requests forservices to be made of it by a computer program.An API differs from an Application Binary Interface in that it is specified in terms of a programming language that can be compiled when an application is built, ratherthan an explicit low level description of how data is laid out in memory.The software that provides the functionality described by an API is said to be animplementation of the API. The API itself is abstract, in that it specifies aninterface and does not get involved with implementation details.An API is often a part of a software development kit (SDK).The term API is used in two related senses:A coherent interface consisting of several classes or several sets of relatedfunctions or procedures.A single entry point such as a method, function or procedure.In general terms, an
API
is system software for an operating system orenvironment, which consists of a standardized set of functions and procedures.Programmers can call these functions and procedures from their programs to gainextra functionality. Because programmers do not have to write this codethemselves, they save time. The system also provides a standard and welldocumented way of working
Design Models
There are various design models for APIs. Interfaces intended for the fastestexecution often consist of sets of functions, procedures, variables and datastructures. However, other models exist as well - such as the interpreter used toevaluate expressions in
ECMAScript/JavaScript 
or in the abstraction layer - whichrelieve the programmer from needing to know how the functions of the
API
relateto the lower levels of abstraction. This makes it possible to redesign or improvethe functions within the
API
without breaking code that relies on it.Some APIs, such as the ones standard to an operating system, are implemented
 
Chapter 13 Scripting Quicktest Professional Page 3
Dani Vainstein Win32API Page 3 of 22
as separate code libraries that are distributed with the operating system. Othersrequire software publishers to integrate the API functionality directly into theapplication. This forms another distinction in the examples above. MicrosoftWindows APIs come with the operating system for anyone to use. Software forembedded systems such as video game consoles generally falls into theapplication-integrated category. While an official PlayStation API document may beinteresting to read, it is of little use without its corresponding implementation, inthe form of a separate library or software development kit.An API that does not require royalties for access and usage is called "open".[1]Although usually authoritative "reference implementations" exist for an API (suchas Microsoft Windows for the Win32 API), there is nothing that prevents thecreation of additional implementations. For example, most of the
Win32 API
canbe provided under a
UNIX
system using software called
Wine
.
Release Policies
Two general lines of API publishing policies:Some companies zealously guard information on their APIs from general publicconsumption. For example, Sony used to make its official PlayStation 2 APIavailable only to licensed PlayStation developers. This enabled Sony to control whowrote PlayStation 2 games. Such control can have quality control benefits andpotential license revenue.Some companies make their APIs freely available. For example, Microsoft makesmost of its API information public, so that software will be written for the Windowsplatform.Companies base their choice of publishing policy on maximizing benefit to them.
API Examples
The PC BIOS call interfaceSingle UNIX Specification (SUS)Microsoft Win32 APIJava Platform, Enterprise Edition APIsASPI for SCSI device interfacingCarbon and Cocoa for the Macintosh OSOpenGL cross-platform APIDirectX for Microsoft WindowsSimple DirectMedia Layer (SDL)Universal Home APILDAP Application Program Interfacesvgalib for Linux and FreeBSDGoogle Maps APIWikipedia APIWebmashup.com The Open Directory for Mashups & Web 2.0 APIs

Activity (12)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
anshulkharub liked this
anshulkharub liked this
umashankar66 liked this
umashankar66 liked this
dablugaurav liked this
praveen.karla liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->