In Win 10 you can Win+Shift+S to take a screenshot of a given section of screen, and can then Ctrl+V into something like Discord and immediately send that screenshot to people.
I'm trying to get that data (presumably a bmp / png format file) from the clipboard using Python and the win32clipboard module, but it's not working and I'm not even sure my approach is correct:
# Using Python 3.10.4
import win32clipboard
win32clipboard.OpenClipboard()
z = win32clipboard.EnumClipboardFormats() # returns '49161'
mem = win32clipboard.GetClipboardData(49161) # returns b'x00\x00\x00\x00....'
dat = win32clipboard.GetGlobalMemory(mem) # raises TypeError: The object is not a PyHANDLE object
# ... don't worry I close the clipboard later.
I can't find any info on how to create a PyHANDLE object and I have a feeling that I'm going down the wrong way. Can someone point me in the right direction?