替代 inet &webbrowser 控件仅检索 HTML? [英] Alternative to inet & webbrowser control to retrieve HTML only?

查看:27
本文介绍了替代 inet &webbrowser 控件仅检索 HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想下载我的 VB6 程序中的 HTML 代码.Webbrowser 控件很好,但它会挂起,而且还有一些问题,例如需要禁用 JavaScript、pic 等才能获得 HTML

I would like to download only the HTML code in my VB6 program. Webbrowser control is good but it hangs and also it has issues such as needing to disable the JavaScript, pic, etc in order to get just the HTML

Inet 控件更好,但它是有问题的"

The Inet control is better, but it is "buggy"

还有其他控制吗?

推荐答案

如果你只想下载一个页面的 HTML,你可以轻松使用 Winsock 控件.

If you only want to download the HTML of a page, you can easily use Winsock control.

Private Sub Form_Load()
  Winsock1.Connect "stackoverflow.com", 80
End Sub

Private Sub Winsock1_Close()
  Winsock1.Close
End Sub

Private Sub Winsock1_Connect()
  Winsock1.SendData "GET /questions/8624871/vb6-alternative-to-inet-webbrowser-control HTTP/1.1" & vbCrLf & "Host: stackoverflow.com" & vbCrLf & vbCrLf
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  Dim s As String

  Winsock1.GetData s, vbString
  RichTextBox1.Text = RichTextBox1.Text & s
End Sub

这篇关于替代 inet &webbrowser 控件仅检索 HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆