def window_full_shot(hwnd, gray=0):
    hwnd = get_hwnd(hwnd)[0]
    print(hwnd)
    print(win32gui.GetClassName(hwnd))
    l, t, r, b = win32gui.GetWindowRect(hwnd)
    h = b - t
    w = r - l
    hwindc = win32gui.GetWindowDC(hwnd)
    srcdc = win32ui.CreateDCFromHandle(hwindc)
    memdc = srcdc.CreateCompatibleDC()
    bmp = win32ui.CreateBitmap()
    bmp.CreateCompatibleBitmap(srcdc, w, h)
    memdc.SelectObject(bmp)
    memdc.BitBlt((0, 0), (w, h), srcdc, (0, 0), win32con.SRCCOPY)
    signedIntsArray = bmp.GetBitmapBits(True)
    img = np.fromstring(signedIntsArray, dtype='uint8')
    img.shape = (h, w, 4)
    print(type(img))
    srcdc.DeleteDC()
    memdc.DeleteDC()
    win32gui.ReleaseDC(hwnd, hwindc)
    win32gui.DeleteObject(bmp.GetHandle())
    if gray == 0:
        return cv2.cvtColor(img, cv2.COLOR_BGRA2BGR)
    else:
        return cv2.cvtColor(img, cv2.COLOR_BGRA2GRAY)
I use this code to shot two windows, one could got a right img, another it ins't work, just like that. the right code the bad code