现在已经把登录成功后的cookie保存下来了,想用这个cookie实现登录。代码如下:
procedure TfrmNewApp.btnCookieSubmitClick(Sender: TObject);
var
docTest:IHTMLDocument2;
temp:WideString
begin
docTest:= (webbrowser1.Document as ihtmldocument2);if not Assigned(myIni) then
    myIni:= TIniFile.Create(ExtractFilePath(Application.ExeName)+  'yiladeng.ini');
    temp := myIni.ReadString('post','cookie','') ;
docTest.cookie:=temp;
webbrowser1.Refresh;
end;但是登录不成功,求高手。webbrowserCookie浏览器

解决方案 »

  1.   

    自己顶一下,自己研究了一下,可以用InternetGetCookieEx获取cookie,然后用  InternetSetCookieEx重新写入Cookie,但不会调用这两个API,求高手
      

  2.   

    我把我的VB代码分享给你吧。
    InternetSetCookie "baidu.com", "username", "abc"
    这是设置COOKIE
    设置baidu.com这个网站的username=abc    Dim nLen   As Long
        Dim sBuff As String * 1024
        nLen = 1024
        Me.Caption = InternetGetCookie("baidu.com", vbNullString, sBuff, nLen)
        Text1.Text = Left$(sBuff, nLen)
    这是读取COOKIE,注意,这里是读取baidu.com中的所有COOKIE值,读取出来的数据是这样的:
    sts=1; wc=70213; lc=54449; lc2=54449; 
    这分别是四个参数,每个参数的值都有。你可以使用split来分离他们。