c++ - WinAPI BitBlt freezes for minutes -


i have little modified qscreen::grabwindow function. , on computers, unfortunately didn't find relationship between them, bitblt freezes minutes! why can happen , can do?

qpixmap detectionflow::grabscreen(hwnd h) {     rect rect;     getclientrect(h, (lprect)&rect);      // height , width of screen     int height = rect.bottom - rect.top;     int width = rect.right - rect.left;      // create , setup bitmap     hdc display_dc = getdc(0);      hdc bitmap_dc = createcompatibledc(display_dc);      hbitmap bitmap = createcompatiblebitmap(display_dc, width, height);      hgdiobj null_bitmap = selectobject(bitmap_dc, bitmap);      hdc window_dc = getdc(h);     bitblt(bitmap_dc, 0, 0, width, height, window_dc, 0, 0, srccopy);      // clean bitmap     releasedc(h, window_dc);      selectobject(bitmap_dc, null_bitmap);      deletedc(bitmap_dc);       const qpixmap pixmap = qt_pixmapfromwinhbitmap(bitmap);      deleteobject(bitmap);      releasedc(0, display_dc);      return pixmap; } 

ps. interesting, on computers, freezes, freezes randomly. there works fast (a couple of ms) , freeze.

problem in aero. computers freezes bitblt has win7 , aero. without aero ok.


Comments