大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> Script -> Internet Explorer对象

Internet Explorer对象

时间: 2021-07-31 作者:daque

运用internet explorer东西不妨使post乞求在ie中爆发,进而摆脱步调,离开了粉饰界面包车型的士处事。步调以至不妨湮没或退出,免除了webbrowser带来的懊恼,固然也不须要第四个参数。

底下咱们仍旧以登岸csdn为例,给出本质的代码,您不妨按照前方作品中供给的参数换成你备案过的站点:

建新工程,在工程中“援用”internet explorer东西,点“欣赏”,在体例文献夹下找到shdocvw.dll(这个文献是ie自带的), form第11中学增添command1,以次是代码——

 

    dim g_oie as internetexplorer

private sub command1_click()

    dim vpost as variant

    dim vheaders as variant

 

    set g_oie = new internetexplorer

    g_oie.visible = true

   

    redim abyte(0) as byte

    cpostdata = "login_name=帐号&password=暗号&cookietime=0"

    packbytes abyte(), cpostdata

   

    vpost = abyte

    vheaders = "content-type: application/x-www-form-urlencoded" + chr(10) + chr(13)

   

    g_oie.navigate "http://www.csdn.net/member/logon.asp", , , vpost, vheaders

   

end sub

private sub packbytes(bytearray() as byte, byval postdata as string)

    inewbytes = len(postdata) - 1

    if inewbytes < 0 then exit sub

    redim bytearray(inewbytes)

    for i = 0 to inewbytes

       ch = mid(postdata, i + 1, 1)

       if ch = space(1) then

          ch = "+"

       end if

       bytearray(i) = asc(ch)

    next

end sub

(请输出本人的帐号及暗号试运转。这种本领的长处是不言而喻的,你不妨按这个本领将前方的代码变革一下。)

packbytes因变量将post出去的数据变化为一个ascii数组,其余vheaders的值必需以“+ chr(10) + chr(13)”中断。

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.