Capturing a Window that is hidden or minimized

后端 未结 3 1575
被撕碎了的回忆
被撕碎了的回忆 2020-12-03 04:27

I followed this tutorial (there\'s a bit more than what\'s listed here because in my code I get a window via mouse click) for grabbing a window as a bitmap and then renderin

3条回答
  •  萌比男神i
    2020-12-03 04:51

    I am trying to get the bitmap of partially hidden controls.

    I used code before that did the drawing, but included windows overlapping it. So.. maybe you want to try this. The WM_PRINTCLIENT should (in my understanding) redraw all inside the control, even if it is not really visible.

    const int WM_PRINT = 0x317, WM_PRINTCLIENT = 0x318, PRF_CLIENT = 4,
    PRF_CHILDREN = 0x10, PRF_NON_CLIENT = 2,
    COMBINED_PRINTFLAGS = PRF_CLIENT | PRF_CHILDREN | PRF_NON_CLIENT;
    SendMessage(handle, WM_PRINTCLIENT, (int)hdc, COMBINED_PRINTFLAGS);
    //GDIStuff.BitBlt(hdc, 0, 0, width, height, hdcControl, 0, 0, (int)GDIStuff.TernaryRasterOperations.SRCCOPY);
    

    The before code is commented out now. It is based on the code found here: Pocket PC: Draw control to bitmap (accepted answer). It is basically the same as Tim Robinson suggests in this thread.

    Also, have a look here http://www.tcx.be/blog/2004/paint-control-onto-graphics/

提交回复
热议问题