识别缩略图加载

# -*- coding: cp936 -*-
from ctypes import *
import win32con
import win32api
import time
while True:
    #引入winapi
    gdi32 = windll.gdi32
    user32 = windll.user32
    #获取句柄
    hdc = user32.GetDC(None)
    #获取指定像素的颜色
    c = gdi32.GetPixel(hdc,2501,1347)
    #打印十进制转化为十六进制的颜色
    rgb=(hex(c))
    # print(rgb)
    if rgb!='0xd77800':
        win32api.keybd_event(34, 0, 0, 0)
    time.sleep(0.5)

 更多按键代号参考此链接

posted @ 2018-09-11 22:47  zhangdingqu  阅读(262)  评论(1编辑  收藏  举报