Jump to content
  • Advertisement
Sign in to follow this  
gargling_mayonnaise

Help with GDI screenshot

This topic is 3553 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, i need a little help, i'd like to take a shot of my desktop using GDI functions but excluding a particular window(i've the hWnd of that window because of a shell hook) so that the final image will have the desktop screen with every windows on it except that window, i've tried to hide it before taking the shot but without any good result, i think the problem was that hiding a windows need at least a refresh of the desktop but i'm taking the shot inside the wndproc, i'm sure i'm doing something wrong with it. Any help appreciated! -GM

Share this post


Link to post
Share on other sites
Advertisement
The problem is refreshing the desktop, i've tried to change the style removing WS_VISIBLE and then calling SetWindowPos to refresh it but desktop keeps holding the window(at least graphically), i need to do it quickly, hide the window take the shot and show back the window, user should not recognize it, the only way it worked was calling ChangeDisplaySettings(0,0) but i think it's a forcing apart from an evident refresh.

-GM

Share this post


Link to post
Share on other sites
How do you set the window style?
Have you tried simply using ShowWindow, or CloseWindow?
Minimizing won't be invisible probably, but not much of a distraction..
Also try putting a Sleep(100) or something after hiding the window, not enough time to really be noticeable, but might be enough for background windows to refresh. Ofcourse this won't be a guarantee on all systems, for that you would probably need to iterate through all visible windows that was behind the window you hide, and call UpdateWindow on them.

Share this post


Link to post
Share on other sites

DWORD style = GetWindowLongPtr(hW,GWL_STYLE);
style &= ~WS_VISIBLE;
SetWindowLongPtr(hW, GWL_STYLE, style );
SetWindowPos( hW, hW, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED );



Uhmm, tried to invalide and update with hwnd_broadcast but nothing to do, it's quite strange, the only way it worked is ChangeDisplaySettings, that is a forcing and it's not good for what i need to do, i really dunno how to get away with it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!