精华内容
下载资源
问答
  • vb WebBrowser屏蔽右键

    2010-10-17 13:38:08
    vb WebBrowser屏蔽右键 vb WebBrowser屏蔽右键
  • vb WebBrowser文件夹视图

    2010-08-17 02:03:32
    通过改变WebBrowser1.Document.CurrentViewMode属性来实现 值 查看方式 1 图标 3 列表 4 详细资料 5 缩略图 6 平铺 7 幻灯片(不允许以幻灯片方式查看时自动改为缩略图)
  • .net和 vb WebBrowser 浏览器兼容问题自己封装的开发中遇到的第一次加载注册表可能未注册 F5一下就会成功
  • VB WebBrowser1设置内核版本

    千次阅读 2018-09-13 16:13:25
    加入注册表 Set x = CreateObject("wscript.shell") ...使用WebBrowser Control控件的应用程序所使用的默认值,在IE7标准模式中按照网页上!DOCTYPE指令来展示网页。 注:11000(0×2af8) IE11

    加入注册表

    Set x = CreateObject("wscript.shell")
    b=x.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\" & App.EXEName)
    If b = "" Then
    Set x = Nothing
    Dim w
    Set w = CreateObject("wscript.shell")
    w.regwrite"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\" & App.EXEName, "2711", "REG_DWORD"
    Set w = Nothing
    Else
    Set x = Nothing
    End If

     

     

    On Error GoTo Err1
    Dim LinkName As String
    LinkName = CreateObject("Wscript.Shell").RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION")
    If LinkName <> "" Then
    Set x = Nothing
    Dim w
    Set w = CreateObject("wscript.shell")
    w.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\" & App.EXEName + ".exe", "2711", "REG_DWORD"
    Set w = Nothing
    Else
    Set x = Nothing
    End If
    Exit Sub
    Err1:
    Exit Sub

    FEATURE_BROWSER_EMULATION设置说明
    说明
    10001 (0x2711)Internet Explorer 10。网页以IE 10的标准模式展现,页面!DOCTYPE无效
    10000 (0x02710)Internet Explorer 10。在IE 10标准模式中按照网页上!DOCTYPE指令来显示网页。Internet Explorer 10 默认值。
    9999 (0x270F)Windows Internet Explorer 9. 强制IE9显示,忽略!DOCTYPE指令
    9000 (0x2328)Internet Explorer 9. Internet Explorer 9默认值,在IE9标准模式中按照网页上!DOCTYPE指令来显示网页。
    8888 (0x22B8)Internet Explorer 8,强制IE8标准模式显示,忽略!DOCTYPE指令
    8000 (0x1F40)Internet Explorer 8默认设置,在IE8标准模式中按照网页上!DOCTYPE指令展示网页
    7000 (0x1B58)使用WebBrowser Control控件的应用程序所使用的默认值,在IE7标准模式中按照网页上!DOCTYPE指令来展示网页。

    注:11000(0×2af8)    IE11

    展开全文
  • VB Webbrowser控件如何屏蔽右键

    千次阅读 2015-12-29 23:29:09
    '加入webbrowser控件 '在窗体上自定义一个菜单(设为MyMenu) '复制下面代码,运行即可禁止右键菜单了 '====窗体代码==== Dim WithEvents M_Dom As MSHTML.HTMLDocument Private Function M_Dom_oncontextmenu()...
    '引用Microsoft HTML OBject Library 
    '加入webbrowser控件 
    '在窗体上自定义一个菜单(设为MyMenu) 
    '复制下面代码,运行即可禁止右键菜单了 
    
    '====窗体代码==== 
    Dim WithEvents M_Dom As MSHTML.HTMLDocument 
    Private Function M_Dom_oncontextmenu() As Boolean 
    M_Dom_oncontextmenu = False 
    End Function 
    Private Sub Webbrowser1_DownloadComplete() 
    Set M_Dom = Webbrowser1.Document '好了,右键菜单没有了 
    me.PopupMenu mymenu '弹出自定义菜单 
    End Sub

    展开全文
  • Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)Dim frm As Form1Set frm = New Form1frm.Visible = TrueSet ppDisp = frm.WebBrowser1.objectEnd Sub 代码2: Private Su...

    代码1:

    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Dim frm As Form1
    Set frm = New Form1
    frm.Visible = True
    Set ppDisp = frm.WebBrowser1.object
    End Sub

     

    代码2:

    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Cancel = True
    WebBrowser1.Navigate2 WebBrowser1.Document.activeElement.href
    End Sub

    代码3:

    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    On Error Resume Next
    Dim frmWB As Form1
    Set frmWB = New Form1
    frmWB.WebBrowser1.RegisterAsBrowser = True
    Set ppDisp = frmWB.WebBrowser1.object
    frmWB.Visible = True
    frmWB.Top = Form1.Top
    frmWB.Left = Form1.Left
    frmWB.Width = Form1.Width
    frmWB.Height = Form1.Height
    End Sub

    功能差不多,任选一个。

    代码1:

    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Dim frm As Form1
    Set frm = New Form1
    frm.Visible = True
    Set ppDisp = frm.WebBrowser1.object
    End Sub

    代码2:

    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Cancel = True
    WebBrowser1.Navigate2 WebBrowser1.Document.activeElement.href
    End Sub

    代码3:

    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    On Error Resume Next
    Dim frmWB As Form1
    Set frmWB = New Form1
    frmWB.WebBrowser1.RegisterAsBrowser = True
    Set ppDisp = frmWB.WebBrowser1.object
    frmWB.Visible = True
    frmWB.Top = Form1.Top
    frmWB.Left = Form1.Left
    frmWB.Width = Form1.Width
    frmWB.Height = Form1.Height
    End Sub

    功能差不多,任选一个。


    转载于:https://www.cnblogs.com/luyichuan/archive/2012/01/11/2318678.html

    展开全文
  • vb webbrowser 保存网页源码的各种…

    千次阅读 2016-02-24 11:22:10
    我在网上找到使用rft控件保存...txtHTML.Text = WebBrowser1.document.body.innerText ´flag :rsftext 保存为txt文件,strtmp文件路径 txtHTML.saveFile strtmp, rtfText 将其name属性设置为web   Private Sub Com

    我在网上找到使用rft控件保存webbrowse文本  txtHtml是RichTextBox
    txtHTML.Text = WebBrowser1.document.body.innerText
    ´flag :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()
    ´页面下载完毕
    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
    ´flag :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文件中如果这个网页中含有框架那么要对框加进行处理。

    展开全文
  • VB WebBrowser解析

    2013-02-28 19:34:45
    vb+Webbrowser控件详解,可以自动化使用浏览器进行网络操作
  • vb6_Webbrowser控件使用技巧 1、获得浏览器信息: Private Sub Command1_Click() WebBrowser1.Navigate "http://www.applevb.com" End Sub Private Sub Command2_Click() Dim oWindow Dim oNav Set oWindow ...
  • vb获取并改变webbrowser中的url
  • 自动登录财付通,难点在于会出现验证码,并且验证码页是在iframe元素下的,出于各种安全考虑,webbrowser控件不提供这种访问机制!当然,第一想到的是将这个网页拿出来,可是输入完毕验证码后,点击“确定”需要与原...
  • VB6.0 WebBrowser阻止弹出窗口的3个办法

    热门讨论 2012-11-04 20:45:59
    VB6.0 WebBrowser阻止弹出窗口的3个办法
  • vb webbrowser中的html与vb交互

    千次阅读 2014-07-11 20:39:12
    Private Sub Form_Load()  Open App.Path & IIf(Right(App.Path, 1) = "\", "", "\") & "E.htm" For Binary As #1  Put #1, , "Name:"  Close #1  WebBrowser1.Navigate App.Path & IIf(Right(A
  • rivate Sub Command1_Click()Dim YDMYDM = WebBrowser1.Document.body.createtextrange().htmltextOpen "D:\WEB.html" For Output As #1Print #1, YDMClose #1End Sub ================= 工程里引用:Microsoft ...
  • VB WebBrowser控件总结

    千次阅读 2011-03-06 09:49:00
    1.webbrowser控件的DocumentComplete和DownloadComplete的区别文档完全下载后,一个 DownloadComplete 事件就被引发。这并不一定表明可以通过对象模型安全地访问文档内容了。DocumentComplete 事件才表明所有的...
  • VB 6.0演示WebBrowser用法制作简单的网页浏览器,主要是以一些WebBrowser.Navigate、WebBrowser.GoBack、WebBrowser.Stop等基本操作函数的用法演示,利用本程序打开和设置默认主页,具体实现如下所示:  Private ...
  • Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean) Dim frm As Form1 Set frm = New Form1 frm.Visible = True Set ppDisp = frm.WebBrowser1.object End Sub 代码2: Private S
  • VB基于WebBrowser组件打开Word文件,显示Word文档的内容,本程序以WebBrowser为窗口,装载Word文档,并显示其中的内容,非常方便的调用word文件的内容,有兴趣的不妨一试。
  • 首先在工程——引用中引用 Microsoft ... Option Explicit Private WithEvents m_MyVar As HTMLInputElement Private Sub Form_Load() ... WebBrowser1.Navigate2 "http://www.xyserver.com" End Sub
  • 有时需要对网页进行操作,但webbrowser控件却为完成装载,即可用此函数检测
  • 摘要:VB源码,网络相关,WebBrowser  VB基于WebBrowser打开播放GIF 动画文件,程序将调用ieframe.dll文件,具体实现的细节请参阅源代码吧。
  • 内容索引:VB源码,文件操作,Word,WebBrowser VB使用WebBrowser控件作为容器打开Word文档文件,可以读取Word的格式等,教你如何在VB编写的程序中读取Word,示例简单,新手也能看懂,比较不错哦。
  • vb,Webbrowser1获取网页源码

    热门讨论 2009-03-25 00:12:21
    Webbrowser1获取网页源码,实例
  • vb6.0-WebBrowser实例

    热门讨论 2010-08-17 11:00:16
    vb6.0-WebBrowser实例,关于提取网页中数据,并将其导入数据库,以备分析或其他之用。是学习的一份好资料。
  • 自动点击WebBrowser,ie等弹出的alert确定,
  • WebBrowser的主要属性  属性名 说明 LocationURL 返回当WebBrower中网页的URL LocationName 返回当WebBrower中网页的标题,即HTML中的Title标记 WebBrowser的主要方法: 方法名 作用 Navigate 浏览网页。如:...
  • 详细讲解: VB_检测WebBrowser网页_刷新_加载_变更_关闭的方法
  • DOCTYPE指令展示网页 '7000 (0x1B58) 使用WebBrowser Control控件的应用程序所使用的默认值,在IE7标准模式中按照网页上!DOCTYPE指令来展示网页。 '注:11000(0×2af8) IE11 '以下函数必须要编译才有效 Public Sub ...
  • 引用:http://zhidao.baidu.com/question/133403436.html WebBrowser1.Navigate "http://www.baidu.com" Do DoEvents If WebBrowser1.ReadyState = 4 Then MsgBox "载入完成": Exit Do Loop

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 3,290
精华内容 1,316
关键字:

vbwebbrowser