»ª·áÈí¼þ

»¥ÁªÍøÈí¼þ×ÊÔ´¹²Ïí

µ±Ç°Î»ÖãºÊ×Ò³ -> ×ÛºÏƵµÀ -> Õ¾³¤Ö®¼Ò

vb webbrowser ±£´æÍøÒ³Ô´ÂëµÄ¸÷ÖÖ·½·¨

ÎÒÔÚÍøÉÏÕÒµ½Ê¹ÓÃrft¿Ø¼þ±£´æwebbrowseÎı¾  txtHtmlÊÇRichTextBox
txtHTML.Text = WebBrowser1.document.body.innerText
êÀšÑã¸×î £ºrsftext ±£´æΪtxtÎļþ£¬strtmpÎļþ·¾¶
txtHTML.saveFile strtmp, rtfText


½«ÆänameÊôÐÔÉèÖÃΪweb

Private Sub Command1_Click()
   web.Navigate ""
End Sub

Private Sub web_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Set doc = web.Document
For Each i In doc.All
   msgbox typename(i)
   Text1.Text = Text1.text & vbclrf & i.innertext
Next
End sub


===========================================================================================
תÔØ

ÒýÓÃ Microsoft HTML Object Library


   Dim oDoc As HTMLDocument
   Dim oElement As Object
   Dim oTxtRgn As Object
   Dim sSelectedText As String
 
   Set oDoc = WebBrowser1.Document»ñµÃÎĵµ¶ÔÏó
   Set oElement = oDoc.getElementById("T1")»ñµÃID="T1"µÄ¶ÔÏó
   Set oTxtRgn = oDoc.selection.createRange»ñµÃÎĵµµ±Ç°ÕýÑ¡ÔñµÄÇøÓò¶ÔÏó
 
   sSelectedText = oTxtRgn.TextÑ¡ÔñÇøÓòÎı¾¸³Öµ

   oElement.Focus"T1"¶ÔÏó»ñµÃ½¹µã

   oElement.SelectèÙÑ¡¶ÔÏó"T1"

   Debug.Print "ÄãÑ¡ÔñÁËÎı¾£º" & sSelectedText


ÉÏÃæÕâ¶Î¶ù»¹¸½ËÍÁËÆäËû¹¦ÄÜ£¬ºÇºÇ¡£¾«¼òÒ»ÏÂÊÇÕâÑù£º
   Dim oDoc As Object
   Dim oTxtRgn As Object
   Dim sSelectedHTML As String
 
   Set oDoc = WebBrowser1.Document »ñµÃÎĵµ¶ÔÏó
   Set oTxtRgn = oDoc.selection.createRange »ñµÃÎĵµµ±Ç°ÕýÑ¡ÔñµÄÇøÓò¶ÔÏó
 
   sSelectedHTML = oTxtRgn.htmlText Ñ¡ÔñÇøÓòÎı¾¸³Öµ


   Text1.Text=sSelectedHTML Êñ±¾¿òÏÔʾץȡµÃHTMLÔ´Âë
   ......»òÕß¼ÌÐø·ÖÎöÔ´Âë


==================================================================================================

ÎÒÓÃWebBrowserÈ¡µÃÍøÒ³Ô´Â룬ֱ½ÓÔËÐÐÕý³££¬µ«ÔÚ±àÒëºó³ö´í
Private Sub Command1_Click()
WebBrowser1.Navigate ""
End Sub

Private Sub WebBrowser1_DownloadComplete()
®IÕÛÏÂÔØÍê±Ï
Dim doc, objhtml
Set doc = WebBrowser1.Document

Set objhtml = doc.body.createtextrange()
If Not IsNull(objhtml) Then
Text1.Text = objhtml.htmltext
End If


End Sub

ÎÒÓÃWebBrowserÈ¡µÃÍøÒ³Ô´Â룬ֱ½ÓÔËÐÐÕý³££¬µ«ÔÚ±àÒëºó³ö´í


Ìáʾ£ºÊµÊ±´íÎó¡°91¡±    Object ±äÁ¿»ò with ¿é±äÁ¿Ã»ÓÐÉèÖÃ
¿ÉÄÜÊÇûÓÐÏÂÔØÍêËùÖ£¬

Private Sub WebBrowser1_DownloadComplete()
if webbrowser.busy=false then
Dim doc, objhtml
Set doc = WebBrowser1.Document


Set objhtml = doc.body.createtextrange()
If Not IsNull(objhtml) Then
Text1.Text = objhtml.htmltext
End If
end if
End Sub

ÄãÒªµÃÍøÒ³Ô´ÂëÓà xmlhttp±È½ÏºÃ


ÏÈÒýÓÃ msxml

Dim x As New MSXML2.XMLHTTP
x.open "get", "", False
x.send

MsgBox StrConv(x.responseBody, vbUnicode)

===============================================================================================
ÎÒÔÚÍøÉÏÕÒµ½Ê¹ÓÃrft¿Ø¼þ±£´æwebbrowseÎı¾  txtHtmlÊÇRichTextBox
txtHTML.Text = WebBrowser1.document.body.innerText
êÀšÑã¸×î £ºrsftext ±£´æΪtxtÎļþ£¬strtmpÎļþ·¾¶
txtHTML.saveFile strtmp, rtfText


=====================================================================================


Private Sub WebBrowser1_DownloadComplete()
   Dim objHtml As Object
   ÏÂÔØÍê³Éʱ״̬À¸ÏÔʾ¡°Link Finished¡±
   Set objHtml = Me.WebBrowser1.Document.Body.Createtextrange()
   If Not IsNull(objHtml) Then
       Text1.Text = objHtml.htmltext
   End If
End Sub
ʹÓÃinet¿Ø¼þ
Source1 = Inet1.OpenURL("")
If Source1 <> "" Then
RichTextBox1.Text = Source1
Me.Inet1.Cancel
Else
Source = MsgBox("Source code is not available.", vbInformation, "Source Code")
End If

Private Sub Command1_Click()
   Text1.Text = WebBrowser1.Document.body.innerHTML
End Sub


==================================================================================
¼ÓÈëtimer,commandbutton,text
private sub command1_click()
webbrowser1.navigate
timer1.enabled=true
end sub


private sub timer1_timer()
dim doc,objhtml as object
dim i as integer
dim strhtml as string

if not webbrowser1.busy then
set doc=webbrowser1.document
i=0
set objhtml=doc.body.createtextrange()
if not isnull(objhtml) then
text1.text=objhtml.htmltext
end if
timer1.enabled=false
end if
end sub


Dim doc, objhtml As Object
If Not webbrowser1.Busy Then
        Set doc = webbrowser1.Document
        Set objhtml = doc.body.createtextrange()
        If Not IsNull(objhtml) Then
           text1.text=objhtml.htmltext
        End If
        Set doc = Nothing
        Set objhtml = Nothing

End If

===================================================================================================
»òÕßÊÔÊÔÓÃInternetReadFile£¬Ð§¹ûÒ²¿ÉÒÔ£º
Option Explicit

Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" ( _
                   ByVal sAgent As String, ByVal lAclearcase/" target="_blank" >ccessType 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 INTERNET_FLAG_NO_CACHE_WRITE = &H4000000
Dim s

Private Function GetUrlFile(stUrl As String) As String
   Dim lgInternet As Long, lgSession As Long
   Dim stBuf As String * 1024
   Dim inRes As Integer
   Dim lgRet As Long
   Dim stTotal As String
   stTotal = vbNullString
   lgSession = InternetOpen("VBTagEdit", 1, vbNullString, vbNullString, 0)
   If lgSession Then
       lgInternet = InternetOpenUrl(lgSession, stUrl, vbNullString, _
                                    0, INTERNET_FLAG_NO_CACHE_WRITE, 0)
       If lgInternet Then
           Do

               inRes = InternetReadFile(lgInternet, stBuf, 1024, lgRet)
               stTotal = stTotal & Mid$(stBuf, 1, lgRet)
           Loop While (lgRet <> 0)
       End If
       inRes = InternetCloseHandle(lgInternet)
   End If
   GetUrlFile = stTotal
End Function


Private Sub Command1_Click()
   Text1.Text = GetUrlFile("")
End Sub

=====================================================================================================

Set vDoc = WebBrowser1.Document
»ñÈ¡ÍøÒ³µÄÔ´Âë
For Each o In vDoc.All
  DoEvents
  htmlpage = htmlpage & o.innerHTML
Next
È»ºóÓÃд¶þ½øÖÆÎļþµÄ·½·¨½«htmlpageµÄÄÚÈÝдÈëµ½.htmlÎļþÖÐÈç¹ûÕâ¸öÍøÒ³Öк¬Óпò¼ÜÄÇôҪ¶Ô¿ò¼Ó½øÐд¦Àí¡£



ÉÏһƪ£ºphpµ÷ÓÃdll¾­ÑéС½á
ÏÂһƪ£ºIIS8/IIS7/IIS6 ³öÏÖADODB.Connec..

ÆÀÂÛ

ÕÊ¡¡¡¡ºÅ: ÃÜÂë: (ÐÂÓû§×¢²á)
Ñé Ö¤ Âë:
±í¡¡Çé:
ÄÚ¡¡¡¡ÈÝ:

ËÑË÷
×îÐÂÎÄÕÂ
ͼƬÖ÷Ìâ
ÈÈÃÅÎÄÕÂ
ÍƼöÎÄÕÂ
Ïà¹ØÎÄÕÂ

    Ê× Ò³   |   °æȨÉùÃ÷   |   ¹ØÓÚÎÒÃÇ   |   ¹ã¸æ·þÎñ   |   ÁªÏµÎÒÃÇ   |   ÊÖ»ú°æ    |   ÍøÕ¾µØͼ
    Copyright@zhuchunyu.com all rights reserved
    Powered by zhuchunyu.com 2018-2025 zhuchunyu.com ÍîICP±¸05011767ºÅ-23