image capture
-
Hi Can anyone help me capturing a part of the window as a bitmap? Currently, the code i wrote captures the top-lying windows as well. I dont want it to capture them. HGDIOBJ prev = SelectObject(memdc, mybitmap); //Drawing functions. BitBlt( memdc, 0, 0, w, h, sourcedc, SRCCOPY); SelectObject(memdc, prev); Thanks
cheers rajesh.r
-
Hi Can anyone help me capturing a part of the window as a bitmap? Currently, the code i wrote captures the top-lying windows as well. I dont want it to capture them. HGDIOBJ prev = SelectObject(memdc, mybitmap); //Drawing functions. BitBlt( memdc, 0, 0, w, h, sourcedc, SRCCOPY); SelectObject(memdc, prev); Thanks
cheers rajesh.r
With GDI, I am honestly not sure you can blit a window if it is hidden behind others (since you do not blit a window but a device). What you can do (if this is not unituitive for the user) is bring the window as topmost, and blit it.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb -
Hi Can anyone help me capturing a part of the window as a bitmap? Currently, the code i wrote captures the top-lying windows as well. I dont want it to capture them. HGDIOBJ prev = SelectObject(memdc, mybitmap); //Drawing functions. BitBlt( memdc, 0, 0, w, h, sourcedc, SRCCOPY); SelectObject(memdc, prev); Thanks
cheers rajesh.r
If you get the device context of an underlying window, shouldn't it output the display of that window? i.e. if you have the handle to the window you want to bitblt, you should be able to do a GetDC() on that window, then blit from that dc... It should blit what is being displayed on that window, regardless of a window is over top of it. I think. Where are you getting the sourcedc in the example?
-
If you get the device context of an underlying window, shouldn't it output the display of that window? i.e. if you have the handle to the window you want to bitblt, you should be able to do a GetDC() on that window, then blit from that dc... It should blit what is being displayed on that window, regardless of a window is over top of it. I think. Where are you getting the sourcedc in the example?
Greg Daye wrote:
It should blit what is being displayed on that window, regardless of a window is over top of it.
Not so. Once it's on the screen it's on the screen. Device contexts obtained for windows represent the device the window is rendered on (the screen).
-
Greg Daye wrote:
It should blit what is being displayed on that window, regardless of a window is over top of it.
Not so. Once it's on the screen it's on the screen. Device contexts obtained for windows represent the device the window is rendered on (the screen).
Yeah. Greg is right. Blitting somehow doesn't restrict itself to the lower level window dc. It takes information from the top level window as well. What I felt was, to somehow update the memory dc after the draw operation. I tried sending WM_PRINT message, which I found in msdn said, it updates the dc. This too doesn't help me. Anymore insights or workarounds to do the job? Thanks
cheers rajesh.r