|
-
Sep 9th, 2002, 06:41 AM
#1
Thread Starter
Fanatic Member
-
Sep 9th, 2002, 06:45 AM
#2
Using an INet control...
VB Code:
Dim strURL As String
Dim HTMLSource As String
strURL = "http://www.google.com/"
HTMLSource = Inet1.OpenURL(strURL, icString)
Text1.Text = HTMLSource
'Using WinInet
Private Declare Function InternetOpen Lib "wininet.dll" 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 InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal sURL As String, ByVal sHeaders As String, ByVal lHeadersLength As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Private Const IF_FROM_CACHE = &H1000000
Private Const IF_MAKE_PERSISTENT = &H2000000
Private Const IF_NO_CACHE_WRITE = &H4000000
Private Const BUFFER_LEN = 256
Private Function GetUrlSource(sURL As String) As String
Dim sBuffer As String * BUFFER_LEN, iResult As Integer, sData As String
Dim hInternet As Long, hSession As Long, lReturn As Long
hSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)
If hSession Then hInternet = InternetOpenUrl(hSession, sURL, vbNullString, 0, IF_NO_CACHE_WRITE, 0)
If hInternet Then
iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
sData = sBuffer
Do While lReturn <> 0
iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
sData = sData + Mid(sBuffer, 1, lReturn)
Loop
End If
iResult = InternetCloseHandle(hInternet)
GetUrlSource = sData
End Function
-
Sep 9th, 2002, 06:47 AM
#3
Thread Starter
Fanatic Member
-
Sep 9th, 2002, 06:59 AM
#4
Thread Starter
Fanatic Member
-
Sep 9th, 2002, 07:18 AM
#5
I did read your question. Why can't you use both, each for its own specific purpose?
-
Sep 9th, 2002, 07:21 AM
#6
Thread Starter
Fanatic Member
-
Sep 9th, 2002, 07:26 AM
#7
Lively Member
use Microsoft HTML Object Library
Like the code below will give u all input type of an HTML page.
VB Code:
'Declarations
Dim objDoc As HTMLDocument
Dim colInputElements As IHTMLElementCollection
Dim objElement As Object
Set objDoc = WebBrowser1.Document
Set colInputElements = objDoc.getElementsByTagName("input")
'loop through each element of the collection
For Each objElement In colInputElements
'look for the specific type of element
MsgBox objElement.Type
Next
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|