import win32guiimport win32conimport sysdef setText(aString): """设置剪贴板文本""" w.OpenClipboard() w.EmptyClipboard() w.SetClipboardData(win32con.CF_UNICODETEXT, aString) w.CloseClipboard()def openWangwAndSend(father,son,msg): setText(msg) fbox = win32gui.FindWindow(None,father) print(fbox); sbox = win32gui.FindWindowEx(fbox,0,None,son) print(son); win32gui.ShowWindow(sbox,1) win32gui.SendMessage(sbox, 258, 22, 0) win32gui.SendMessage(sbox, 770, 0, 0) win32gui.SendMessage(sbox, win32con.WM_KEYDOWN, win32con.VK_RETURN, 0) win32gui.SendMessage(sbox, win32con.WM_KEYUP, win32con.VK_RETURN, 0) win32gui.ShowWindow(sbox, 2) #发送旺旺群father = u'阿里旺旺 - ****'son=u'****'openWangwAndSend(father,son,'for test~')代码如上,print(son)这行,能打印出名称,但后面的打开窗口和发送消息一直不行,感觉没有定位到,求大神指教。
添加回答
举报
0/150
提交
取消