APIs in QTP
QTP APIs can have following data types
micDispatch =9 ; IDispatch*
micWideString =18 ; WChar*
micUnknown =20 ; IUnknown
Has anyone used any API with these data types? Do you know when these can be helpful?
Re: APIs in QTP
See if below mentioned description helps you.
To run a function from a DLL, you need to declare the function for use. To do this, use the Extern.Declare method. Then call the function using Extern.<function name>.
Extern.Declare(RetType, MethodName, LibName, Alias [, ArgType(s)])
RetType Data type of the value returned by the method. For available data types, refer to the "Declare Data Types" topic in the QuickTest Object Model Reference.
MethodName Any valid procedure name.
LibName Name of the DLL or code resource that contains the declared procedure.
Alias Name of the procedure in the DLL or code resource.
- DLL entry points are case sensitive.
- If Alias is an empty string, MethodName is used as the Alias.
ArgType(s) A list of data types representing the data types of the arguments that are passed to the procedure when it is called. For available data types, refer to the "Declare Data Types" topic in the QuickTest Object Model Reference.
- For out arguments, use the micByRef flag.
' The following example demonstrates how to call the FindWindow function from "user32.dll."
Extern.Declare micHwnd, "FindWindow", "user32.dll", "FindWindowA", micString, micString
hwnd = Extern.FindWindow("Notepad", vbNullString)
' The following example demonstrates how to call the GetWindowText function from "user32.dll."
Extern.Declare micLong, "GetWindowText", "user32.dll", "GetWindowTextA", micHwnd, micString + micByRef, micLong
hWnd = Browser("micclass:=Browser","Index:=0").GetROPrope rty ("hwnd")
retVal = Extern.GetWindowText (hWnd, txt, 256)
QuickTest Professional supports the following pointers: CHAR*, IDispatch*, WChar*, and void* (micString, micDispatch, micWideString, and micVPtr respectively).
For additional examples and information, refer to the "Declare method" topic in the QuickTest Object Model Reference (Object Model Reference -> Utility Objects -> Extern Object -> Declare Method).
Re: APIs in QTP
well this is from QTP help and i have already gone through it