Einzelnen Beitrag anzeigen

thomas2009
(Gast)

n/a Beiträge
 
#6

Re: Screenshot mit Quickinfo ?

  Alt 2. Jan 2009, 21:32
Zitat von mkinzler:
Versuch es mal mit
DC := CreateCompatibleDC( GetDC (GetDesktopWindow));
Ich erhalte ein weißes Bild

Aber diese Funktion, was ich über google gefunden habe, kopiert alles
Das Prinzip ist so ähnlich, was @Toms vorgeschlagen hat :

Delphi-Quellcode:
procedure CaptureScreen(Bitmap: TBitmap);
const
  CAPTUREBLT = $40000000;
var
  hdcScreen: HDC;
  hdcCompatible: HDC;
  bmp: TBitmap;
  hbmScreen: HBITMAP;
begin
  // Create a normal DC and a memory DC for the entire screen. The
  // normal DC provides a "snapshot" of the screen contents. The
  // memory DC keeps a copy of this "snapshot" in the associated
  // bitmap.
  hdcScreen := CreateDC('DISPLAY', nil, nil, nil);
  hdcCompatible := CreateCompatibleDC(hdcScreen);

  // Create a compatible bitmap for hdcScreen.
  hbmScreen := CreateCompatibleBitmap(hdcScreen,
    GetDeviceCaps(hdcScreen, HORZRES),
    GetDeviceCaps(hdcScreen, VERTRES)
  );

  // Select the bitmaps into the compatible DC.
  SelectObject(hdcCompatible, hbmScreen);

  //Copy color data for the entire display into a
  //bitmap that is selected into a compatible DC.
  bmp := TBitmap.Create;
  bmp.Handle := hbmScreen;

  BitBlt(hdcCompatible,
    0, 0,
    bmp.Width, bmp.Height,
    hdcScreen,
    0, 0,
    SRCCOPY or CAPTUREBLT);

  Bitmap.Assign(bmp);
  bmp.Free;

  DeleteDC(hdcScreen);
  DeleteDC(hdcCompatible);
end;
  Mit Zitat antworten Zitat