07-26-2018, 09:00 AM
Function PostLeftClickMessage
;/
function w x y [flags] ;;flags: 1 down only, 2 up only, 4 activate window, 8 move mouse
;Posts message WM_LBUTTONDOWN and/or WM_LBUTTONUP to window w or its child control at that point.
;w - window or control.
;x, y - point coordinates in w client area.
;REMARKS
;It is an alternative to lef. With some windows works even if the window is not active.
;Works not with all windows/controls. Try flag 4 or/and 8.
;Does not wait until the window receives and processes the message.
;EXAMPLE
;int w=win("Notepad")
;PostLeftClickMessage(w 10 10)
if(w=0) end ERR_WINDOW
if(flags&4) act w
if(flags&8) mou x y w 1
int w1=child(x y w 8); err
if(w1) MapWindowPoints(w w1 +&x 1); w=w1
int lparam=MakeInt(x y)
if(flags&2=0) PostMessage w WM_LBUTTONDOWN MK_LBUTTON lparam
if(flags&1=0) PostMessage w WM_LBUTTONUP 0 lparam