Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Probleme mit Screenshots (https://www.delphipraxis.net/79431-probleme-mit-screenshots.html)

bobo220673 22. Okt 2006 14:27


Probleme mit Screenshots
 
Hallo!
Ich habe ein kleines Problem mit dem schießen von Screenshots.Ich benutze die Komponente "Embedded Web Browser Components Package" (http://www.bsalsa.com/downloads.html) zum erstellen von Thumbs einer Webseite.
Das Problem ist das ich das Programm auf einem Server mit einer Windows2005 Server Webedition laufen lasse, und dieser Server zeigt zwar alles per Remote Desktop in Farbe an, aber "local" arbeitet der Server leider nur mit sehr wenigen Farben, so das die Thumbs nur in Schwarz/Weiß gemacht werden.
Hier ist die betreffende Function der Komponente (EWBTools.pas):

Delphi-Quellcode:
function GetJPEGfromBrowser(Document: IDispatch; ControlInterface: IWebBrowser2; FileName: string; SourceHeight, SourceWidth,
  TargetHeight, TargetWidth: Integer): Boolean;
var
  sourceDrawRect: TRect;
  targetDrawRect: TRect;
  sourceBitmap: Graphics.TBitmap;
  targetBitmap: Graphics.TBitmap;
  aJPG: TJPEGImage;
  aViewObject: IViewObject;
  IWeb: IWebBrowser2;
begin
  Result := False;
  sourceBitmap := Graphics.TBitmap.Create;
  targetBitmap := Graphics.TBitmap.Create;
  aJPG := TJPEGImage.Create;
  IWeb := ControlInterface;
  try
    try
      sourceDrawRect := Rect(0, 0, SourceWidth, SourceHeight);
      sourceBitmap.Width := SourceWidth;
      sourceBitmap.Height := SourceHeight;
      aViewObject := IWeb as IViewObject;
      if aViewObject = nil then Exit;
      OleCheck(aViewObject.Draw(DVASPECT_CONTENT, 1, nil, nil,
        Forms.Application.Handle,
        sourceBitmap.Canvas.Handle,
        @sourceDrawRect, nil, nil, 0));
      targetDrawRect := Rect(0, 0, TargetWidth, TargetHeight);
      targetBitmap.Height := TargetHeight;
      targetBitmap.Width := TargetWidth;
      targetBitmap.Canvas.StretchDraw(targetDrawRect, sourceBitmap);
      aJPG.Assign(targetBitmap);
      aJPG.SaveToFile(FileName);
      Result := True;
    finally
      aJPG.Free;
      sourceBitmap.Free;
      targetBitmap.Free;
    end;
  except
    Result := False;
  end;
end;

Hat vieleicht jemand eine Idee wie ich Farbige Thumbs erstellen kann, auch wenn der Server mit so wenigen Farben arbeitet ???


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:20 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz