Draw the screen to a window using StretchBlt()
I'm working on a program to capture the screen and then draw it on a window.
This is the drawing thread function:
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);
}
}
The problem is StretchBlt is too slow(about 20 fps) What should I do to
improve the performance? Thanks.
No comments:
Post a Comment