mhammond / pywin32

Python for Windows (pywin32) Extensions
5.09k stars 803 forks source link

Using the pywin32 library to take multiple screenshots of a certain window, through HWND returns a black screen. #1702

Closed Coding-man12435676543 closed 3 years ago

Coding-man12435676543 commented 3 years ago

Taking multiple screenshots of a certain window using HWND to simulate a video returns a black screen in cv.imshow()

*Result: Using HWND returns a black screen

Creating Instance and using screenshot function in loop

`wincap = WindowCapture('Albion Online Client')

loop_time = time() while(True):

screenshot = wincap.get_screenshot()

cv.imshow('Computer Vision', screenshot)

# debug the loop rate
print('FPS {}'.format(1 / (time() - loop_time)))
loop_time = time()

# press 'q' with the output window focused to exit.
# waits 1 ms every loop to procress key presses
if cv.waitKey(1) == ord('q'):
    cv.destroyAllWindows()
    break

print('Done')`

mhammond commented 3 years ago

This sounds like a support request - please see https://github.com/mhammond/pywin32/blob/master/README.md#support