Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Cách thực hiện: Sử dụng các hàm API InternetOpen,InternetReadFile. để tải nội dung từ 1 địa chỉ.Bạn xem code mẫu sau, trong đó hàm: Private Function InternetGetContent(sServerName As String, sFileName As String, Optional sUsername As String = vbNullString, Optional sPassword As String = vbNullString, Optional lBufferSize As Long = -1) As String Thực hiện việc download nội dung (html source code) từ file sFileName, đặt tại host: sServerName. | Viewcode Website với VB Cách thực hiện Sử dụng các hàm API InternetOpen InternetReadFile. để tải nội dung từ 1 địa chỉ. Bạn xem code mẫu sau trong đó hàm Private Function InternetGetContent sServerName As String sFileName As String Optional sUsername As String vbNullString Optional sPassword As String vbNullString Optional lBufferSize As Long -1 As String Thực hiện việc download nội dung html source code từ file sFileName đặt tại host sServerName. Bạn tạo 1 ứng dụng mới sau đó copy paste đoạn code sau vào Form1 rồi chạy thử nhé. Code Option Explicit Private Declare Function InternetOpen Lib wininet Alias InternetOpenA ByVal sAgent As String ByVal lAccessType As Long ByVal sProxyName As String ByVal sProxyBypass As String ByVal lFlags As Long As Long Private Declare Function InternetCloseHandle Lib wininet ByVal hInet As Long As Integer Private Declare Function InternetReadFile Lib wininet ByVal hFile As Long ByVal sBuffer As String ByVal lNumBytesToRead As Long lNumberOfBytesRead As Long As Integer Private Declare Function InternetConnect Lib wininet.dll Alias InternetConnectA ByVal hInternetSession As Long ByVal sServerName As String ByVal nServerPort As Integer ByVal sUsername As String ByVal sPassword As String ByVal lService As Long ByVal lFlags As Long ByVal lContext As Long As Long Private Declare Function HttpQueryInfo Lib wininet.dll Alias HttpQueryInfoA ByVal hHttpRequest As Long ByVal lInfoLevel As Long ByRef sBuffer As Any ByRef lBufferLength As Long ByRef lIndex As Long As Integer Private Declare Function HttpOpenRequest Lib wininet.dll Alias HttpOpenRequestA ByVal hHttpSession As Long ByVal sVerb As String ByVal sObjectName As String ByVal sVersion As String ByVal sReferer As String ByVal something As Long ByVal lFlags As Long ByVal lContext As Long As Long Private Declare Function HttpSendRequest Lib wininet.dll Alias HttpSendRequestA ByVal hHttpRequest As Long ByVal sHeaders As String ByVal lHeadersLength As Long sOptional As Any ByVal .