AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Screenshot of semitransparent window

Ein Thema von WojTec · begonnen am 27. Nov 2013 · letzter Beitrag vom 27. Nov 2013
Antwort Antwort
WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#1

Screenshot of semitransparent window

  Alt 27. Nov 2013, 09:32
Delphi-Version: 2010
I have window with 32-bit PNG as background, so window is (semi)transparent in some areas. How to make screenshot of this window without desktop underneath it (like taskbar thumbnails in 7, you know)?
  Mit Zitat antworten Zitat
Benutzerbild von Sherlock
Sherlock

Registriert seit: 10. Jan 2006
Ort: Offenbach
3.763 Beiträge
 
Delphi 11 Alexandria
 
#2

AW: Screenshot of semitransparent window

  Alt 27. Nov 2013, 10:44
During the screenshot underlay the window with some monochrome panel. Check Screenpresso or similar modern screenshot tools for results.

Sherlock
Oliver
Geändert von Sherlock (Morgen um 16:78 Uhr) Grund: Weil ich es kann
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#3

Re: AW: Screenshot of semitransparent window

  Alt 27. Nov 2013, 11:21
underlay the window with some monochrome panel
How
  Mit Zitat antworten Zitat
Benutzerbild von Sherlock
Sherlock

Registriert seit: 10. Jan 2006
Ort: Offenbach
3.763 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: Screenshot of semitransparent window

  Alt 27. Nov 2013, 13:26
Well, if it is your window and you want to use this function more often, my first approach would be to create a second window in the same application with the same exact measurements and xy coordinates only the z being lower (or is it higher ). This new form should of course not be transparent, and have some uniform color (gray for best results). Show this form only during screenshot event...and presto!

If it is not your window and application however, things can get a wee bit more tricky. You would have to find out all the necessary size and position data yourself and create the backdrop window according to the gathered information.
I guess MSDN-Library durchsuchenFindWindow and MSDN-Library durchsuchenGetWindowRect are a good starting point for that.

Sherlock
Oliver
Geändert von Sherlock (Morgen um 16:78 Uhr) Grund: Weil ich es kann
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#5

Re: Screenshot of semitransparent window

  Alt 27. Nov 2013, 17:37
Yes, I know how to make normal screenshot:

Delphi-Quellcode:
begin
  hDesktop := GetDesktopWindow;
  hScreenDC := GetWindowDC(hDesktop);
  hMemDC := CreateCompatibleDC(hScreenDC);
  hbm := CreateCompatibleBitmap(hScreenDC, AWidth, AHeight);
  try
    SelectObject(hMemDC, hbm);
    BitBlt(hMemDC, 0, 0, AWidth, AHeight, hScreenDC, ALeft, ATop, R[AReversed]);

    AOutput.Width := AWidth;
    AOutput.Height := AHeight;
    if AOutput.Canvas.TryLock then
    begin
      try
        AOutput.PixelFormat := pf24bit;
        BitBlt(AOutput.Canvas.Handle, 0, 0, AWidth, AHeight, hMemDC, 0, 0, SRCCOPY);
      finally
        AOutput.Canvas.Unlock;
      end;
    end;
  finally
    ReleaseDC(hDesktop, hScreenDC);
    DeleteDC(hMemDC);
    DeleteObject(hbm);
  end;
end;
Is required more than pf32bit or TBitmap32. F1
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:44 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