QTP FTP
All FTP functions require a handle to a FTP session and InternetConnect function [that opens an IP port for a special service (FTP in our case)] returns an handle for that service. InternetConnect function requires an handle to an open Internet session, which is returned by a function called InternetOpen.
So in order to use any of the FTP functions, we simply have to call InternetOpen followed by InternetConnect.
So after we are done with our handles we have to call the InternetCloseHandle, twice, the first time to close our FTP session handle and the second to close the Internet session handle.
The order of things - so there are four basic steps we have to do to use any of the FTP functions:
1. Get an Internet connection by calling InternetOpen,
2. Connect to the host by calling InternetConnect,
3. Call any of the FTP functions,
4. Close the handles created in steps 1 and 2.
You can see QTP examples of below mentioned FTP functions:
FTP InternetOpen & InternetConnect
FTPGetFile
FTPPutFile
FTPOpenFile
FTPSetCurrentDirectory
FTPCreateDirectory
FTPRenameFile
FTPRemoveDirectory
FTPDeleteFile
Each of the above functions use Extern object to load particular DLL files. e.g.
Extern.Declare micHwnd, "FunctionName", "DLLName.dll", "FunctionNameA", micString
where:
micHwnd - data type of value returned by function
FunctionName - valid procedure name.
DLLName.dll - name of the DLL to call.
FunctionNameA -Alias - A string that represents name of the procedure in the DLL.
micString - arguments to be pased to the function, these can be one or more.