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

Thread: printscreen GetDC(NULL) Vista/7

  1. #1
    Join Date
    May 2011

    printscreen GetDC(NULL) Vista/7


    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 : , 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 ?


  2. #2
    Join Date
    Mar 2010
    Melbourne Australia

    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

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)