Have tested, can't set the focus to the window (at least not using GuiControl and the guis hwnd).
Ignore edit2, I was right the first time.
Here is a little example that works like a normal edit, but if you click somewhere in the last 10px of the control it will set the focus away from the edit control.
Code: Select all
#SingleInstance,Force
Gui, 1:+AlwaysOnTop -Caption hwndGuiHwnd
Gui, 1:Margin, 0, 0
Gui, 1:Add, Text, x190 ym w10 h0 BackgroundTrans hwndTexthwnd gSetFocus
Gui, 1:Add,Edit, xm ym w200 r1 hwndEdit1Hwnd ,
GuiControlGet, pos, 1:Pos, % Edit1Hwnd
GuiControl, 1:MoveDraw, % TextHwnd, % "h" PosH
gosub, SetFocus
Gui, 1:Show, x10 y10 , Gui 1
return
*Esc::ExitApp
SetFocus:
GuiControl, 1:Focus, % Texthwnd
return