python controls the windows clipboard to write instances of images to the clipboard

  • 2020-11-03 22:29:40
  • OfStack

As shown below:


from ctypes import *
import os
import win32con,win32clipboard

aString=windll.user32.LoadImageW(0,"new.bmp",win32con.IMAGE_BITMAP,0,0,win32con.LR_LOADFROMFILE)
print(aString)
if aString !=0: ##  Due to picture coding problems   Picture failed to load  aString  Is equal to 0 
 win32clipboard.OpenClipboard()
 win32clipboard.EmptyClipboard()
 win32clipboard.SetClipboardData(win32con.CF_BITMAP, aString)
 win32clipboard.CloseClipboard()

Related articles: