Results 1 to 7 of 7

Thread: web browser control

  1. #1

    Thread Starter
    Fanatic Member faisalkm's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    752

    web browser control

    How to access the HTML of a webpage through webbrowser control?

    for eg:- i do webbrowser.Navigate2("http://www.microsoft.com")

    now how to get the HTML of this page?
    Faisal Muhammed
    Homepage:I Started making it in 1994 ...Still Under Construction
    Using

    Visual Basic 6.0 Enterprise SP5
    Embedded Visual Basic 3.0
    SQL Server 2000
    Windows 2000 Proff
    Delphi 6.0


    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Using an INet control...

    VB Code:
    1. Dim strURL As String
    2. Dim HTMLSource As String
    3. strURL = "http://www.google.com/"
    4. HTMLSource = Inet1.OpenURL(strURL, icString)
    5. Text1.Text = HTMLSource
    6. 'Using WinInet
    7. 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
    8. 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
    9. Private Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
    10. Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
    11.  
    12. Private Const IF_FROM_CACHE = &H1000000
    13. Private Const IF_MAKE_PERSISTENT = &H2000000
    14. Private Const IF_NO_CACHE_WRITE = &H4000000
    15.        
    16. Private Const BUFFER_LEN = 256
    17.  
    18. Private Function GetUrlSource(sURL As String) As String
    19.     Dim sBuffer As String * BUFFER_LEN, iResult As Integer, sData As String
    20.     Dim hInternet As Long, hSession As Long, lReturn As Long
    21.  
    22.     hSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)
    23.     If hSession Then hInternet = InternetOpenUrl(hSession, sURL, vbNullString, 0, IF_NO_CACHE_WRITE, 0)
    24.  
    25.     If hInternet Then
    26.         iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
    27.         sData = sBuffer
    28.         Do While lReturn <> 0
    29.             iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
    30.             sData = sData + Mid(sBuffer, 1, lReturn)
    31.         Loop
    32.     End If
    33.    
    34.     iResult = InternetCloseHandle(hInternet)
    35.  
    36.     GetUrlSource = sData
    37. End Function

  3. #3

    Thread Starter
    Fanatic Member faisalkm's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    752
    I guess u did'nt read my question properly...i need it using webbrowser control..b'cauz i tried using the inet control and since I have a proxy with authentication the method using inet control does'nt seem to work..
    Faisal Muhammed
    Homepage:I Started making it in 1994 ...Still Under Construction
    Using

    Visual Basic 6.0 Enterprise SP5
    Embedded Visual Basic 3.0
    SQL Server 2000
    Windows 2000 Proff
    Delphi 6.0


    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  4. #4

    Thread Starter
    Fanatic Member faisalkm's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    752
    Anyone ...pls ..pls help
    Faisal Muhammed
    Homepage:I Started making it in 1994 ...Still Under Construction
    Using

    Visual Basic 6.0 Enterprise SP5
    Embedded Visual Basic 3.0
    SQL Server 2000
    Windows 2000 Proff
    Delphi 6.0


    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I did read your question. Why can't you use both, each for its own specific purpose?

  6. #6

    Thread Starter
    Fanatic Member faisalkm's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    752
    i told u inet is not working b'cauz of my proxy settings
    Faisal Muhammed
    Homepage:I Started making it in 1994 ...Still Under Construction
    Using

    Visual Basic 6.0 Enterprise SP5
    Embedded Visual Basic 3.0
    SQL Server 2000
    Windows 2000 Proff
    Delphi 6.0


    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  7. #7
    Lively Member
    Join Date
    Apr 2002
    Location
    India
    Posts
    105
    use Microsoft HTML Object Library

    Like the code below will give u all input type of an HTML page.

    VB Code:
    1. 'Declarations
    2. Dim objDoc As HTMLDocument
    3. Dim colInputElements As IHTMLElementCollection
    4. Dim objElement As Object
    5.  
    6. Set objDoc = WebBrowser1.Document
    7. Set colInputElements = objDoc.getElementsByTagName("input")
    8.  
    9. 'loop through each element of the collection
    10. For Each objElement In colInputElements
    11.     'look for the specific type of element
    12.     MsgBox objElement.Type
    13. Next
    Shahab Ahmed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width