Code: Select all
BtnClick(Control, WinTitle:="", WinText:="", ExcludeTitle:="", ExcludeText:="") {
static WM_COMMAND := 0x111, BN_CLICKED := 0
if WinExist(WinTitle, WinText, ExcludeTitle, ExcludeText) {
ControlGet, hwndCtl, Hwnd,, %Control%
CtrlID := DllCall("GetDlgCtrlID", "ptr", hwndCtl)
SendMessage, WM_COMMAND, (BN_CLICKED << 16) | (CtrlID & 0xffff), hwndCtl
}
}