r/AskProgramming • u/VagueHorizon_ • Oct 08 '26
Can I capture a Minimized Window ?
I am trying to build an app that needs to capture the visual output of a specific window, even if it is in background or minimized.
I don't want to capture whole screen or other windows, only the target window. I also need the actual rendered pixels rather than app's internal data.
It needs a continuous stream of visual output of that specific window so it can analyze what is happening in real time.
Is this technically possible ? If so, what APIs or graphics concepts should I go for ?
Or should I abandon the idea and go for dom scraping because this is specifically for web but dom scraping is detectable which is not our goal.
11
u/Software-fullstack Oct 08 '26 edited Oct 08 '26
technically in win32 at the moment a window being minimized it stops receive wm_paint aka you can't because there is no pixels at all for minimized windows.
but there are few workarounds for this ofc but it is all about "fake minimize" or "app internal data" but truly minimized window doesn't have pixels at all except "internal data".
7
u/burlingk Oct 08 '26
What are you actually specifically trying to accomplish?
What are you expecting to "see" and analyze on that window?
Is it actually visible or just data?
5
u/0jdd1 Oct 08 '26 edited Oct 09 '26
On most windowing systems I know of, minimized windows no longer have a size or location, so drawing is essentially impossible. Depending on a lot of things, it may be possible to add a virtualization layer beneath your app that captures and logs all the virtual paint operations, and that maintains a fake virtual size and location. The odds are against it, but please tell us more.
2
u/TheMrCurious Oct 08 '26
Why are you scraping the window? Your scenario sounds a bit sus.
1
u/prophet-dot-exe Oct 09 '26
Use dbus API or direct Wayland protocol, ext-image-copy-capture-v1
Edit: just adding that there's no guarantee the window would continue painting or that even the last buffer would necessarily be retained, but try it out and see if it works for what you need
1
u/xplorerex Oct 09 '26
Depends how the app handles being minimised.