1

我正在开发一个程序来捕获屏幕然后在窗口上绘制它。

这是绘图线程函数:

void DrawFunc(void*hwnd)
{
    HDC windowdc=GetDC((HWND)hwnd);
    HDC desktopdc=GetDC(GetDesktopWindow());
    for(;;)
    {
        RECT rect;
        GetClientRect((HWND)hwnd,&rect);
        StretchBlt(windowdc,0,0,rect.right-rect.left,rect.bottom-rect.top,desktopdc,0,0,1920,1080,SRCCOPY);
    }
}

问题是 StretchBlt 太慢(大约 20 fps) 我应该怎么做才能提高性能?谢谢。

4

0 回答 0