To Check Url Size With VB6 which you just need size from URL which you wants .....
To get size url you must add 1 component in visual basic. Thats components is msinet which this file need msinet.dll to register to your windows, almost of people call this Microsoft Internet Transfer Control 6.0. You can Check Url Size and follow this step :
1. Add Component Microsoft Internet Transfer Control 6.0/msinet.dll on your VB program
2. Click and place it into your form1 (default form1)
3. Make 1 Textbox (default name is Text1.text)
4. Make 1 Button (default name is Command1) and paste this code :
Private Sub Command7_Click()
GetSize (Text1.Text)
End Sub
5. Make 1 Label (default name is Label1)
6. Paste this Code to your form
Private Function GetSize(ByVal sURL As String)
Dim sBuffer As String, sResult As String
With Inet1
.Execute sURL, "HEAD", ,
While .StillExecuting
DoEvents
Wend
Do
DoEvents
sBuffer = .GetChunk(1024, icString)
sResult = sResult & sBuffer
FileSize = CLng(.GetHeader("Content-length"))
If FileSize < 1024 Then Label1.Caption = FileSize & " Bytes" ElseIf FileSize >= 1024 And FileSize < 1048576 Then Label1.Caption = Round(FileSize / 1024, 2) & " KB" ElseIf FileSize >= 1048576 Then
Label1.Caption = Round(FileSize / 1048576, 2) & " MB"
End If
Loop While Len(sBuffer)
GetSize = sResult
End With
Exit Function
Err:
GetSize = vbNullString
End Function
Finishhhhh ....
Private Sub Command7_Click()
GetSize (Text1.Text)
End Sub
5. Make 1 Label (default name is Label1)
6. Paste this Code to your form
Private Function GetSize(ByVal sURL As String)
Dim sBuffer As String, sResult As String
With Inet1
.Execute sURL, "HEAD", ,
While .StillExecuting
DoEvents
Wend
Do
DoEvents
sBuffer = .GetChunk(1024, icString)
sResult = sResult & sBuffer
FileSize = CLng(.GetHeader("Content-length"))
If FileSize < 1024 Then Label1.Caption = FileSize & " Bytes" ElseIf FileSize >= 1024 And FileSize < 1048576 Then Label1.Caption = Round(FileSize / 1024, 2) & " KB" ElseIf FileSize >= 1048576 Then
Label1.Caption = Round(FileSize / 1048576, 2) & " MB"
End If
Loop While Len(sBuffer)
GetSize = sResult
End With
Exit Function
Err:
GetSize = vbNullString
End Function
Finishhhhh ....
0 comments:
Posting Komentar