加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

VB获得迅雷资讯弹出网页的源代码

发布时间:2020-12-17 00:31:28 所属栏目:大数据 来源:网络整理
导读:迅雷资讯弹出网页采用UTF-8编码,需要编制自定义函数对XMLHTTP对象获得的源代码进行转换: Private Declare Function MultiByteToWideChar Lib "kernel32" ( ByVal CodePage As Long , ByVal dwFlags As Long , ByVal lpMultiByteStr As Long , ByVal cchMul
迅雷资讯弹出网页采用UTF-8编码,需要编制自定义函数对XMLHTTP对象获得的源代码进行转换:
  1. PrivateDeclareFunctionMultiByteToWideCharLib"kernel32"(ByValCodePageAsLong,ByValdwFlagsAsLong,ByVallpMultiByteStrAsLong,ByValcchMultiByteAsLong,ByVallpWideCharStrAsLong,ByValcchWideCharAsLong)AsLong
  2. PrivateConstCP_UTF8=65001
  3. FunctionUtf8ToUnicode(ByRefUtf()AsByte)AsString
  4. DimlRetAsLong
  5. DimlLengthAsLong
  6. DimlBufferSizeAsLong
  7. lLength=UBound(Utf)-LBound(Utf)+1
  8. IflLength<=0ThenExitFunction
  9. lBufferSize=lLength*2
  10. Utf8ToUnicode=String$(lBufferSize,Chr(0))
  11. lRet=MultiByteToWideChar(CP_UTF8,VarPtr(Utf(0)),lLength,StrPtr(Utf8ToUnicode),lBufferSize)
  12. IflRet<>0Then
  13. Utf8ToUnicode=Left(Utf8ToUnicode,lRet)
  14. EndIf
  15. EndFunction
  16. FunctionSourcecodeofXunleizixun(ByValmenuindexAsLong)AsString
  17. Dimb()AsByte,indexurl(5)AsString
  18. IfNotmenuindexLike"[0-5]"ThenExitFunction
  19. indexurl(0)="http://recommend.xunlei.com/desknews_v2_game.html"'0---游戏
  20. indexurl(1)="http://recommend.xunlei.com/desknews_v2_ent.html"'1---娱乐
  21. indexurl(2)="http://biz5c.sandai.net/desktopnews/iframe/hot_14.htm"'2---婚恋
  22. indexurl(3)="http://www.eachnet.com/landing/xunlei08_3.html"'3---网购
  23. indexurl(4)="http://biz5c.sandai.net/desktopnews/iframe/hot_2.htm"'4---财经
  24. indexurl(5)="http://biz5c.sandai.net/desktopnews/iframe/hot_3.htm"'5---IT
  25. WithCreateObject("Msxml2.XMLHTTP")
  26. .Open"GET",indexurl(menuindex),False
  27. .Send
  28. b=.ResponseBody
  29. EndWith
  30. SourcecodeofXunleizixun=Utf8ToUnicode(b)
  31. EndFunction
  32. SubGetxunlei()
  33. Debug.PrintSourcecodeofXunleizixun(1)'娱乐资讯
  34. EndSub

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读