Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Screenshot Windows 7 Win Server 2008 R' taskbar extension (https://www.delphipraxis.net/180145-screenshot-windows-7-win-server-2008-r-taskbar-extension.html)

Gate 25. Apr 2014 15:37

Delphi-Version: XE3

Screenshot Windows 7 Win Server 2008 R' taskbar extension
 
Hi,

Windows 7, right click the System menu. I want to take a screenshot of the menu.

Thumbnail Bar or Customizing Jump List or Jump List
Example: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

I need help in this regard.

Thanks to everyone in advance

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  I: integer;
  b: TBitMap;
begin
  fwin := True;
  while True do
  begin
    if fwin = FALSE then
      exit;

    b := TBitMap.Create;
    try
      Application.ProcessMessages;
      Sleep(100);
//      ScreenShot(0, 0, 1364, 768, b);
      Capture(1364, 768,b);
      Image1.Picture.Assign(b);
    finally
      b.Free;
    end;
  end;
end;

function TForm1.Capture(Width, Height: integer;bm: TBitMap): Boolean;
var
  dc: HDC;
  RasterOp, ExStyle: DWORD;
begin
  result := FALSE;

    if ((Width = 0) or (Height = 0)) then
    exit;
  bm.Width := Width;
  bm.Height := Height;

  RasterOp := SRCCOPY;
  ExStyle := GetWindowLong(Handle, GWL_EXSTYLE);
  if (ExStyle and WS_EX_LAYERED) = WS_EX_LAYERED then
    RasterOp := SRCCOPY or CAPTUREBLT;

  dc := GetDCEx(0, 0, DCX_WINDOW or DCX_NORESETATTRS or DCX_CACHE);
//dc := GetDCEx(0, 0, DCX_WINDOW or DCX_NORESETATTRS or DCX_CACHE or DCX_CLIPCHILDREN or DCX_CLIPSIBLINGS or DCX_PARENTCLIP or DCX_EXCLUDERGN or
//DCX_INTERSECTRGN or DCX_EXCLUDEUPDATE or DCX_INTERSECTUPDATE or DCX_LOCKWINDOWUPDATE or DCX_VALIDATE);

//dc := GetWindowDC(GetDesktopWindow);
    if (dc = 0) then
    exit;
  try
  SelectClipRgn(bm.Canvas.Handle, FRgn);
    result := BitBlt(bm.Canvas.Handle, 0, 0, 1320, 768, dc, 0, 0, RasterOp);
    SelectClipRgn(bm.Canvas.Handle, 0);
  finally
    ReleaseDc(0, dc);
//    ReleaseDC(GetDesktopWindow, dc);
  end;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 03: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