请问向指定窗口发送后台按键消息?
列如我想向已经打开的Windows的画图工具发送ALT+I和A的按键消息,应该怎么做啊?[ 本帖最后由 s77m72 于 2008-10-28 15:53 编辑 ] 没高手在吗? 下面这个是新开一个mspaint, 向现有的发送的话,可以把run注释掉
AutoItSetOption("WinTitleMatchMode", 4)
$PID=run("mspaint.exe");
WinWait("classname=MSPaintApp");
$hWin=WinGetHandle("classname=MSPaintApp");
$hCanvas=ControlGetHandle($hWin,"","");
ControlSend($hWin,"",$hCanvas,"{ALT}");
ControlSend($hWin,"",$hCanvas,"I");
ControlSend($hWin,"",$hCanvas,"A"); 请问楼上的大哥
$hCanvas=ControlGetHandle($hWin,"","");
中的
classnn:Afx:1000000:81
是什么意思 控件ID,看下帮助的函数说明
举个其他的例子
e.g. Send text to the 1st Edit control in the Notepad window
ControlSend("Untitled - Notepad", "", "", "This is some text")
or
ControlSend("Untitled - Notepad", "", "", "This is some text")
or
ControlSend("Untitled - Notepad", "", "Edit1", "This is some text") 如果要发送的窗口的控件时轻量控件,找不到句柄,而且API POSTMESSAGE函数也被屏蔽,有什么方法可以实现后台按键发送呀? 恩,不错。对一般的窗口挺管用
页:
[1]