Use wininet how to operate?
CodePudding user response:
Public strData as string
'it can return to the first level of server directory name, stored in strData, if there are multiple folders name each folder name will be separated by Spaces, read the sentence segment,
Rc.inet1. Execute rc.inet1. URL, "dir" "" & amp; DirName & amp; "" ""
Do
DoEvents
Loop While rc.inet1. StillExecuting=True
Msgbox strData
'is into this directory, in order to get all the folder name in the server, you can use recursion method to obtain,
Rc.inet1. Execute rc.inet1. URL, "CD" "" & amp; DirName & amp; "" ""
Do
DoEvents
Loop While rc.inet1. StillExecuting=True
Private Sub Inet1_StateChanged (ByVal State As an Integer)
Select the Case State
Case 1
StatusBar1. Panels. The Item (1). The Text="this control is the query specified by the IP address of the host"
Case 2
StatusBar1. Panels. The Item (1). The Text="this control has been successfully find the IP address of the host specified by"
Case 3
StatusBar1. Panels. The Item (1). The Text="this control is connected to the host"
Case 4
StatusBar1. Panels. The Item (1). The Text="this control has been connected to the host success"
Case 5
StatusBar1. Panels. The Item (1). The Text="this control is to host sends a request"
Case 6
StatusBar1. Panels. The Item (1). The Text="the control request has been successfully"
Case 7
StatusBar1. Panels. The Item (1). The Text="this control is the response of the receiving host"
Case 8
StatusBar1. Panels. The Item (1). The Text="this control has been successfully received the response of the host"
Case 9
StatusBar1. Panels. The Item (1). The Text="this control is lifted and host connection"
Case 10
StatusBar1. Panels. The Item (1). The Text="this control has successfully connected to the host lifted the"
Case 11
MsgBox "communicate with the host appeared error", vbInformation, "personal data"
Case 12
Dim vtData As the Variant
Dim bDone As Boolean
BDone=False
'the first block,
VtData=https://bbs.csdn.net/topics/Inet1.GetChunk (1024, icString)
DoEvents
The Do While Not bDone
StrData=https://bbs.csdn.net/topics/strData & vtData
'in the next block,
VtData=https://bbs.csdn.net/topics/Inet1.GetChunk (1024, icString)
DoEvents
Then If Len (vtData)=0
BDone=True
End the If
Loop
StatusBar1. Panels. The Item (1). The Text="the request has been completed, and all data have been received,"
In Case the Else
StatusBar1. Panels. The Item (1). The Text=rc.inet1. ResponseCode & amp; ":" & amp; Rc.inet1. ResponseInfo
End the Select
End Sub
CodePudding user response:
Where is this copy,,,,,,, sure is wrong, I use the inet control, the following code win10 can use, application on the xp machine doesn't work? Consult a great godPrivate Sub Command2_Click ()
List1. Clear
Dim strData As String
Rc.inet1. URL=Mid (Label1 Caption, 7)
On the Error Resume Next
Rc.inet1. RequestTimeout=1
Rc.inet1. Execute rc.inet1 URL, "dir/" & amp; Label2. Caption
The Do While rc.inet1. StillExecuting
DoEvents
Loop
StrData=https://bbs.csdn.net/topics/Inet1.GetChunk (1000)
Rc.inet1. Cancel
Dim (a) As String
(a)=Split (strData, vbCrLf)
For I=0 To UBound (a ())
If a (I) & lt;> "" Then List1. AddItem (a (I))
Next I
End Sub
CodePudding user response: