There are two windows. One window overlaps another. The top window with transparency intercepts clicks and directs them to the window below.
Code: Select all
OnMessage 0x0201, WM_LBUTTONDOWN
MakeLong(LoWord, HiWord )
{
return (HiWord << 16) | (LoWord & 0xffff)
}
; --------------------------------------------
win1 := Gui("AlwaysOnTop")
win1.BackColor := 0xFFFFFF
Btn := win1.AddButton("Default x0 y0 w100", "Test")
Btn.OnEvent("Click", Btn_Click)
Btn_Click(*){
MsgBox "Btn_Click()"
}
win1.Show("x0 y0 w900 h400")
; --------------------------------------------
win2 := Gui("AlwaysOnTop")
win2.BackColor := 0xFFFFFF
win2.Show("x0 y0 w900 h400")
WinSetTransparent 100, "ahk_id" win2.Hwnd
; --------------------------------------------
WM_LBUTTONDOWN(wParam, lParam, msg, hwnd) {
if(hwnd != win2.Hwnd){
return
}
if wParam == 0x0001{
; LBUTTONDOWN
PostMessage 0x201, 0x0001, MakeLong(4, 4),, win1.Hwnd
;WM_LBUTTONUP
PostMessage 0x202, 0, MakeLong(4, 4), , win1.Hwnd
}
}
PostMessage() doesn't seem to send messages.