我想输入用户名,密码后,点击我的窗体上的登录按钮自动在webbrowser里打开登陆进去的页面

解决方案 »

  1.   

    引用DHTML.ocx或者你要用到session什么的好想要引用一个asp的什么组件,偶记不清了,呵呵
      

  2.   

    可以利用INET控件做到自动发贴,INET可以POST信息到服务器。
    不过要先自己研究下对反网页的POST参数,下面是CSDN回贴的参数及INET的POST用法,楼主参考
    strReply = "csdnname=YourName&csdnpassword=YourPassword&Topicid=XMLID&ReplyContent=" & Text1.Text
    strUrl = "http://expert.csdn.net/Expert/reply.asp"
    Inet1.Execute strUrl, "Post", strReply, "Content-Type: application/x-www-form-urlencoded"
    Do
       DoEvents
    Loop While Inet1.StillExecuting = True
      

  3.   

    借楼主的宝地学习一下TO:hsn1982(久违了,肥猫) 
    的能说得再详细一些吗??
    谢谢!
      

  4.   

    怎么编程把用户名,密码提交到网页上的登录页?
    首先在程序中加入Webbrowser控件并加入引用 Microsoft HTML Object Library。
    假设你的HTML页面表单代码如下:
    <form method="POST" action="http://chen/dll/chat/chatmain.exe/RegUser">
      <p>请填写下面表单注册(*项为必添项)</p>
      <p>*姓名<input type="text" name="Name" size="20"></p>
      <p>*昵称<input type="text" name="NickName" size="20"></p>
      <p>电子邮件<input type="text" name="EMail" size="20"></p>
      <p>*密码<input type="text" name="Password" size="20"></p>
      <p><input type="submit" value="提交" name="B1"><input type="reset" value="全部重写" name="B2"></p>
    </form>
    注意其中元素的type、Name、value属性。然后VB中的代码如下:
    Private Sub Command1_Click()
        WebBrowser1.Navigate "http://chen/chat/newuser.htm"
    End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
        Dim vDoc, vTag
        Dim i As Integer
          
        Set vDoc = WebBrowser1.Document
        List1.Clear
        For i = 0 To vDoc.All.length - 1
            If UCase(vDoc.All(i).tagName) = "INPUT" Then
                Set vTag = vDoc.All(i)
                If vTag.Type = "text" Or vTag.Type = "password" Then
                    List1.AddItem vTag.Name
                    Select Case vTag.Name
                        Case "Name"
                            vTag.Value = "IMGod"
                        Case "NickName"
                            vTag.Value = "IMGod"
                        Case "Password"
                            vTag.Value = "IMGodpass"
                        Case "EMail"
                            vTag.Value = "[email protected]"
                    End Select
                ElseIf vTag.Type = "submit" Then
                    vTag.Click
                End If
            End If
        Next i
    End Sub
    点击Command1就可以自动填表并提交了。 
      

  5.   

    1,在vb工程中引用HTML object libary 
    2.在控件中引用microsoft internet Control控件
    3,当webbrowser控件open一个URL后,也就是在webbrowser1的documentcomplete事件中写:Option ExplicitPrivate Sub Command1_Click()
        WebBrowser1.Navigate2 "http://st.lzu.edu.cn"
    End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    On Error GoTo ErrMsg
        Dim mDocument As HTMLDocument
        Dim mText As HTMLTextElement
        Set mDocument = WebBrowser1.document
        ’此时此document就和网页中一样使用了
        Set mText = mDocument.All("LoginName")
        mText.Value = "jdskjk02"
        Set mText = mDocument.All("Password")
        mText.Value = "××××××××××"
        
    ’    mDocument.open
        
    ’    再引用窗体名称
        Dim mForm As HTMLFormElement
        Set mForm = mDocument.All("Submit")
        mForm.Click
        
        Exit Sub
    ErrMsg:End Sub