CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2022
    Posts
    2

    How to capture the screen of a window that contains transparency?

    Trying to find a way to capture a window that contains transparency that also works when the window is covered by another.

    I tried the function [PrintWindow] but it doesn't store the transparency information in the hdc.
    If possible using gdi+.


    https://docs.microsoft.com/en-us/win...er-printwindow

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: How to capture the screen of a window that contains transparency?

    Victor Nijegorodov

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: How to capture the screen of a window that contains transparency?

    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4
    Join Date
    Jan 2022
    Posts
    2

    Re: How to capture the screen of a window that contains transparency?

    2kaud, tell me how linking to a topic that got no useful answer could help in something?
    I posted on different websites because I was not finding any helpful answers.

    Quote Originally Posted by VictorN View Post
    I already had tried BitBlc with the rasters SRCCOPY and CAPTUREBLT
    Then I did GdipCreateFromHDC to retrieve the graphics from the dc, and GdipDrawImageRectRect to paint the bitmap, but it result in a bitmap without any transparency.
    Last edited by c7aesa7r; January 20th, 2022 at 10:08 AM.

  5. #5
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: How to capture the screen of a window that contains transparency?

    @c7aesa7r - It is good etiquette to indicate where else it has been posted. This enables any potential reply-er to find out what has already been suggested before spending time replying or looking into the issue. People who reply do it in their own time without payment - just to try to help others.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  6. #6
    Join Date
    Oct 2022
    Posts
    1

    Re: How to capture the screen of a window that contains transparency?

    There are a few ways to capture the screen of a window that contains transparency. One way is to use the Snipping Tool. Another way is to use the Print Screen function.

  7. #7
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: How to capture the screen of a window that contains transparency?

    Quote Originally Posted by Hacon View Post
    There are a few ways to capture the screen of a window that contains transparency. One way is to use the Snipping Tool. Another way is to use the Print Screen function
    Neither Snipping Tool nor Print Screen resolve the problem if the window is covered by another. Please, read carefully the original post!

    Quote Originally Posted by c7aesa7r View Post
    Trying to find a way to capture a window that contains transparency that also works when the window is covered by another.

    I tried the function [PrintWindow] but it doesn't store the transparency information in the hdc.
    If possible using gdi+.
    Last edited by ovidiucucu; October 28th, 2022 at 01:17 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured