printscreen GetDC(NULL) Vista/7
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: printscreen GetDC(NULL) Vista/7

  1. #1
    Join Date
    May 2011
    Posts
    0

    printscreen GetDC(NULL) Vista/7

    Hi,

    I'm not entirely sure whether it's the good section to post this but here it is.

    A while ago I made a simple app that takes screenshots at random intervals using the GDI. It's been working great under windows XP but unfortunately not at all under Vista and Seven. To be more accurate, it still works when I'm trying to capture the desktop or any window, even maximized but as soon as I toggle a full screen openGL application, I only get black screenshots.

    Since it also happened when I tried to take a screenshot manually using the "Print Screen" key, I decided to do some research. Apparently, Vista and Seven now use a Desktop Window Manager which deals with the displaying by compositing the windows sent to it so we no longer have direct access to the frame being displayed.

    Again, according to this link : http://www.opengl.org/pipeline/article/vol003_7/ , in full screen HW mode, there is no compositing, so when you try to access the content of the screen using GDI's GetDC(NULL) function, all you get is a black screen since there's nothing being drawn behind the 3D app !

    Strangely enough, it works when I'm launching a full screen Direct3D application ! But unfortunately the article doesn't meantion anything about it..

    So I don't really know what to do here.. Is there a way to force compositing even when an full screen OpenGL application is on ? Or is there any other way to get this GDI method to work ? If not, what are the other methods to capture screenshots for any type of applications (D3D and OpenGL) that work on XP/Vista and Seven ? Like, how does programs like FRAPS do it, do you know ?

    Thanks.

  2. #2
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    Re: printscreen GetDC(NULL) Vista/7

    not entirely sure , you should look at hooking OpenGL API , to be precise , raster functions have a look at this link

    http://opengl.czweb.org/ch11/347-350.html

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center