George, I don't think I want to ignore windows. On the contrary I want to send messages to the topmost popup even if it's not the main window.
teadrinker, thank you! This works perfectly. Exactly what I wanted.
On a side note: the script I posted originally was exactly what was working for me most of the time. Note that I passed variables to a command without wrapping them in percent signs. How did that work? Documentation sounds like it shouldn't have. Does PostMessage support symbolic message names? My current script is like this, and it works well:
Code: Select all
WM_INPUTLANGCHANGEREQUEST := 0x50
INPUTLANGCHANGE_FORWARD := 0x0002
HKL_NEXT := 1
Capslock::
ControlGetFocus, CtrlFocus, A
PostMessage, %WM_INPUTLANGCHANGEREQUEST%, %INPUTLANGCHANGE_FORWARD%, %HKL_NEXT%, %CtrlFocus%, A
Return