这个代码只能支持一个窗口进行刷屏,name变量是窗口名,for i in range(1):括号中的数字是发送数量,由于是初学python如有不足请大佬们指教
from unicodedata import name
import win32gui
import win32con
import win32clipboard as w
class qqshuapin:
def send(self,msg):
name="我的Android手机"
w.OpenClipboard()
w.EmptyClipboard()
w.SetClipboardData(win32con.CF_UNICODETEXT, msg)
w.CloseClipboard()
handle = win32gui.FindWindow(None, name)
win32gui.SendMessage(handle, 770, 0, 0)
win32gui.SendMessage(handle, win32con.WM_KEYDOWN, win32con.VK_RETURN, 0)
def main(self):
msg = '四缺一'
for i in range(1):
self.send(msg)
if __name__ == '__main__':
message_send = qqshuapin()
message_send.main()
qq窗口和运行代码的软件要同时在一面才可以运行