python用sendmessage函数向其他程序的编辑框(当前激活窗口,并且在活动光标处)内发送

python用sendmessage函数向其他程序的编辑框(当前激活窗口,并且在活动光标处)内发送汉字,程序怎么写?

这就是个windows SDk的编程问题

#coding:utf-8

from ctypes import *

WM_SETTEXT = 0x000C


def ChangeActiveWindowTtile():
hwnd=windll.user32.FindWindowW(u"Notepad",u"无标题 - 记事本")
if (windll.user32.IsWindow(hwnd)):
windll.user32.SendMessageW(hwnd,WM_SETTEXT,None,u"我是标题")

ChangeActiveWindowTtile()

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答