搜索
首页 电脑/网络 程序设计 VB

求助:用VB查看网页源代码

求助:用VB查看网页源代码的程序.在Text2里面显示Text1里面指网页的源代码.请问程序怎么写?谢谢!

全部回答

2006-05-29

0 0

    Private Declare Function InternetOpen Lib "wininet。dll" Alias "InternetOpenA" ( _ ByVal sAgent As String, ByVal lAccessType 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 Public 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) DoEvents 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 & StrConv(LeftB$(StrConv(stBuf, vbFromUnicode), lgRet), vbUnicode) Loop While (lgRet <> 0) End If inRes = InternetCloseHandle(lgInternet) End If GetUrlFile = stTotal End Function Private Sub Command1_Click() Text2。
    text=GetUrlFile(Text1。text) End Sub 自己测试了一下,顺便把源码给你。

类似问题换一批

热度TOP

相关推荐
加载中...

热点搜索 换一换

电脑/网络
VB
程序设计
电脑装机
操作系统/系统故障
硬件
笔记本电脑
百度
互联网
反病毒
软件
程序设计
VB
数据库
C/C++
JAVA相关
C#/.NET
VC++
汇编语言
其他编程语言
VB
VB
举报
举报原因(必选):
取消确定举报