用delphi的form,form上有个memo控件,
怎样把memo里内容放进一个网页上的textarea里呢?
谢谢高手指教

解决方案 »

  1.   

    procedure TForm1.PutData;
    var
      ShellWindow: IShellWindows;
      nCount: integer;
      spDisp: IDispatch;
      i,j,X: integer;
      vi: OleVariant;
      IE1: IWebBrowser2;
      IDoc1: IHTMLDocument2;
      iELC  : IHTMLElementCollection ;
      S,S2 : string;
      HtmlInputEle : IHTMLInputElement;
      HtmlSelEle   : IHTMLSelectElement;
    begin
      ShellWindow := CoShellWindows.Create;
      nCount := ShellWindow.Count;  for i := 0 to nCount - 1 do
      begin
        vi := i;
        spDisp := ShellWindow.Item(vi);
        if spDisp = nil then continue;
        spDisp.QueryInterface( iWebBrowser2, IE1 );
        if IE1 <> nil then
        begin
          IE1.Document.QueryInterface(IHTMLDocument2,iDoc1);
          if iDoc1 <> nil then
          begin        ielc:=idoc1.Get_all;        for j:=0 to ielc.length-1 do
            begin
              Application.ProcessMessages;
              spDisp := ielc.item(J, 0);
              if SUCCEEDED(spDisp.QueryInterface(IHTMLInputElement ,HtmlInputEle))then
              with HtmlInputEle do
              begin
                S2:=Type_;
                S2:=UpperCase(S2);
    //我把所有的input都填上 try , checkbox 都打勾
                if (StrComp(PChar(S2),'TEXT')=0) or (StrComp(PChar(S2),'PASSWORD')=0) then
                  value :='try' //S:=S+#9+Value
                else if StrComp(PChar(S2),'CHECKBOX')=0 then
                begin
                  checked := True;
                end;
              end;
              if SUCCEEDED(spDisp.QueryInterface(IHTMLselectelement ,HtmlSelEle))then
              with HtmlSelEle, Memo1.Lines do
              begin
                S:=S+#9+IntToStr(selectedIndex+1);  //这个是获取数据了
              end;
            end;  //END FOR
            Memo2.Lines.Add(S);
            exit;
          end;
        end;
      end;
    end;
    from 超级猛料