| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2394 人关注过本帖
标题:关于InternetReadFile的问题
取消只看楼主 加入收藏
xykz
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2008-6-11
收藏
 问题点数:0 回复次数:0 
关于InternetReadFile的问题
请问怎么用InternetReadFile把网页源代码读到一个byte数组里

如下面的一段程序:

程序代码:
Option Explicit
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType 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

Function GetCode(Url As String) As String
    Dim Hwnd1 As Long
    Dim Hwnd2 As Long
    Dim Hwnd3 As Long
    Dim Hwnd4 As Long
    Dim Str1 As String * 1024
    Const INTERNET_FLAG_NO_CACHE_WRITE = &H4000000
    Hwnd1 = InternetOpen("VBTagEdit", 1, vbNullString, vbNullString, 0)
    Hwnd2 = InternetOpenUrl(Hwnd1, Url, vbNullString, 0, INTERNET_FLAG_NO_CACHE_WRITE, 0)
    If Hwnd2 <> 0 Then
        Do
            Hwnd4 = InternetReadFile(Hwnd2, Str1, 1024, Hwnd3)
            GetCode = GetCode & Mid$(Str1, 1, Hwnd3)
        Loop While (Hwnd3 <> 0)
    End If
    InternetCloseHandle (Hwnd2)
End Function


返回的是string类型的。。。怎样才能返回byte类型呢?
搜索更多相关主题的帖子: InternetReadFile 
2008-06-17 19:24
快速回复:关于InternetReadFile的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022730 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved