如题~

解决方案 »

  1.   

    uses 
      UrlMon; function DownloadFile(SourceFile, DestFile: string): Boolean; 
    begin 
      try 
        Result := UrlDownloadToFile(nil, PChar(SourceFile), PChar(DestFile), 0, 
          nil) = 0; 
      except 
        Result := False; 
      end; 
    end; procedure TForm1.Button1Click(Sender: TObject); 
    var 
      k, p: Integer; 
      Source, dest, ext: string; 
    begin 
      for k := 0 to WebBrowser1.OleObject.Document.Images.Length - 1 do 
      begin 
        Source := WebBrowser1.OleObject.Document.Images.Item(k).Src; 
        p := LastDelimiter('.', Source); 
        ext := UpperCase(Copy(Source, p + 1, Length(Source))); 
        if (ext = 'GIF') or (ext = 'JPG') then 
        begin 
          p  := LastDelimiter('/', Source); 
          dest := ExtractFilePath(ParamStr(0)) + Copy(Source, p + 1, 
            Length(Source)); 
          DownloadFile(Source, dest); 
        end; 
      end; 
    end; 
      

  2.   

    ypchina(无崖子) ( )说得好,如何用程序做呢?如何直接复制到剪贴板?
      

  3.   

    aiirii(ari-爱的眼睛) 的需要重新下载图片,能否直接复制到剪贴板?.
    zhouzhouzhou(人生程序) 的怎么实现保存?
      

  4.   

    看看这个uses 
      MSHTML_TLB, JPEG, ActiveX, ComObj; procedure generateJPEGfromBrowser(browser: iWebBrowser2; jpegFQFilename: string; 
      srcHeight: Integer; srcWidth: Integer; tarHeight: Integer; tarWidth: Integer); 
    var 
      sourceDrawRect: TRect; 
      targetDrawRect: TRect; 
      sourceBitmap: TBitmap; 
      targetBitmap: TBitmap; 
      jpeg: TJPEGImage; 
      viewObject: IViewObject; 
    begin 
      sourceBitmap := TBitmap.Create; 
      targetBitmap := TBitmap.Create; 
      jpeg := TJPEGImage.Create; 
      try 
        try 
          sourceDrawRect := Rect(0, 0, srcWidth, srcHeight); 
          sourceBitmap.Width  := srcWidth; 
          sourceBitmap.Height := srcHeight;       viewObject := browser as IViewObject;       if viewObject = nil then 
            Exit;       OleCheck(viewObject.Draw(DVASPECT_CONTENT, 1, nil, nil, Form1.Handle, 
            sourceBitmap.Canvas.Handle, @sourceDrawRect, nil, nil, 0));       // Resize the src bitmap to the target bitmap 
          targetDrawRect := Rect(0, 0, tarWidth, tarHeight); 
          targetBitmap.Height := tarHeight; 
          targetBitmap.Width  := tarWidth; 
          targetBitmap.Canvas.StretchDraw(targetDrawRect, sourceBitmap);       // Create a JPEG from the Bitmap and save it 
          jpeg.Assign(targetBitmap);       jpeg.SaveToFile(jpegFQFilename); 
        finally 
          jpeg.Free; 
          sourceBitmap.Free; 
          targetBitmap.Free; 
        end; 
      except 
        // Error Code 
      end; 
    end; procedure TForm1.btnButton1Click(Sender: TObject); 
    var 
      IDoc1: IHTMLdocument.; 
      Web: ShDocVW_TLB.IWebBrowser2; 
      tmpX, tmpY: Integer; 
    begin 
      with WebBrowser1 do 
      begin 
        document.QueryInterface(IHTMLdocument., iDoc1); 
        Web := ControlInterface; 
        tmpX := Height; 
        tmpY := Width; 
        TControl(WebBrowser1).Visible := Boolean(0); 
        Height := OleObject.document.ParentWindow.Screen.Height; 
        Width := OleObject.document.ParentWindow.Screen.Width; 
        generateJPEGfromBrowser(Web,'c:\test.jpg',Height, Width, Height, Width); 
        Height := tmpX; 
        Width := tmpY; 
        TControl(WebBrowser1).Visible := Boolean(1); 
      end; 
    end;
      

  5.   

    aiirii(ari-爱的眼睛) 的需要重新下载图片,能否直接复制到剪贴板?.
    月底结贴,请多关照。