如何根据控件句柄实现控件单击
如何根据控件句柄实现控件单击麻烦好心人给个例子,谢谢{:face (197):} 没人知道吗 用 控件ID 不行吗,非要 控件句柄 ControlClick("", "", "MDIClient1") 谢谢两位,由于一些原因我想用句柄来单击控件 听说_WinAPI_PostMessage函数可以实现用句柄单击控件,可是不会用 #Include <WinAPI.au3>
_WinAPI_PostMessage("0x00050722(控件句柄)", "", "Click", "1")
这代码不行 #Include <WinAPI.au3>
$hWid = 控件句柄
$CtrlID = _WinAPI_GetDlgCtrlID($hWid)
ControlClick("窗口标题", "窗口文本", '") 谢谢8楼我试试 ControlClick("窗口标题", "",_WinAPI_GetDlgCtrlID("0x00050722"))
也不行 ControlClick("窗口标题", "", "控件ID) & "]") ControlClick("窗口标题", "", "")
用ID也不行,用类别名可以,但是我想用句柄来单击控件 请问11楼WinAPI_GetDlgCtrlID这个函数是什么用的 GetDlgCtrlID accepts child window handles as well as handles of controls in dialog boxes. An application sets
the identifier for a child window when it creates the window by assigning the identifier value to the hmenu
parameter when calling the CreateWindow or CreateWindowEx function. Although GetDlgCtrlID may return a value
if $hWnd identifies a top-level window, top-level windows cannot have identifiers and such a return value is
never valid.
英文看不懂不知道啥意思 楼主试试运行下面这个脚本,看有没有效果#Include <WinAPI.au3>
Run("Notepad.EXE")
WinActivate("", "")
MsgBox(48,"已激活脚本编辑窗口","单击确定后将向记事本编辑框发送鼠标点击命令" & @CRLF & "注意看记事本编辑窗口是否有光标")
$HWND = ControlGetHandle("", "", "Edit1") ;取得记事本窗口 Edit1 控件的控件句柄
ControlClick("", "", "")