屏幕拍摄窗口遮挡

时间:2012-02-22 18:20:18

标签: c++ windows

我的应用程序中有一个命令可以保存应用程序主窗口的副本。现在我想定期保存这个窗口的副本。这需要显示窗口。如果窗口没有显示或部分遮挡,我会得到遮挡它的东西。如果窗口在顶部,有没有办法获得显示的内容?我不想把窗户带到顶端。

这是我一直在做的事情的片段......

    HDC         scrdc, memdc;
    HBITMAP     membit;
    EncoderParameters encoderParameters;
    ULONG       quality;
    Status      status;
    RECT Rect;

    scrdc = GetWindowDC (hWnd); 
    GetWindowRect(hWnd,&Rect);
    int Height = Rect.bottom-Rect.top;
    int Width  = Rect.right-Rect.left;

    memdc = CreateCompatibleDC(scrdc);
    membit = CreateCompatibleBitmap(scrdc, Width, Height);
    HBITMAP hOldBitmap =(HBITMAP) SelectObject(memdc, membit);
    BitBlt(memdc, 0, 0, Width, Height, scrdc, 0, 0, SRCCOPY);

0 个答案:

没有答案
相关问题