如何用命令复制网页上选中的文字到剪贴板?
如何用命令把网页上的文字全部选中?

解决方案 »

  1.   

    如果你是在程序中嵌入一个webbrowser来访问网页,那最简单的办法是发送,ctrl+c(复制ascII码好像是3)和ctrl+a(全选,ascii码好像是1)。如果是对于外部的ie,那就只有老套路了,findwindow或者enumwindow等函数去找到这个ie的窗口hwnd,然后sendmessage一个按键过去,当然,这个按键也是ctrl+c或ctrl+a。
      

  2.   

    新建一个新工程,加入一个 Internet Transfer Control、一个 CommandButton 及二个 TextBox!Text1 用來输入要取取的网页位址,例如:http://www.microsoft.com/taiwan/support/products/vb.htm
    Text2 用來输入要存文件的完整文件名,例如:c:\temp\temp.htmPrivate Sub Command1_Click()
    Dim b() As Byte
    '取消所有操作
    Inet1.Cancel
    '设定协议为 HTTP
    Inet1.Protocol = icHTTP
    '设定 URL 属性
    Inet1.URL = Text1.Text
    '将读取的 HTML 数据放进一个 byte array.
    b() = Inet1.OpenURL(, icByteArray)
    '建立一个暂存文件來存放取回來的 html 文件
    Open Text2.text For Binary Access Write As #1
    Put #1, , b()
    Close #1
    End Sub
      

  3.   


    Set ie = CreateObject("InternetExplorer.Application")
    ie.Navigate "http://office.9zp.com"
    ie.Visible = True
    MsgBox "等待网页打开"
    ie.ExecWB 17, 0  '全选
    ie.ExecWB 12, 0  'COPY