InetClose
关闭 InetGet() 返回的句柄.
InetClose ( handle )
参数
返回值
返回 True:
|
句柄找到并关闭
|
False:
|
没有完成对应操作
|
备注
InetGet() 句柄必须关闭, 不然残留资源不会释放.
下载过程中关闭句柄会导致取消下载.
函数示例
#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
Example()
Func Example()
; Save the downloaded file to the temporary folder.
Local $sFilePath = _WinAPI_GetTempFileName(@TempDir)
; Download the file in the background with the selected option of 'force a reload from the remote site.'
Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True.
Do
Sleep(250)
Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
; Retrieve the number of total bytes received and the filesize.
Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD)
Local $iFileSize = FileGetSize($sFilePath)
; Close the handle returned by InetGet.
InetClose($hDownload)
; Display details about the total number of bytes read and the filesize.
MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _
"The total filesize: " & $iFileSize)
; Delete the file.
FileDelete($sFilePath)
EndFunc ;==>Example
----------------------------------------
该函数可以通过命令调用 exect
参见:
InetGet
exect=$var_h=InetGet('http://www.mozilla.org',@DesktopDir&'\mozilla.html',1,1)||Sleep(1000)||$var_a=InetGetInfo($var_h,-1)||_ViewValues($var_a)||InetClose($var_h) ;; 下载页面并提供信息
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|