I found this NoActivate GuiClass, which can be used for an On-Screen keyboard (as example):
https://www.autohotkey.com/boards/viewtopic.php?t=7611
I'm trying to add the possibility to move the Gui by using:
Code: Select all
OnMessage(0x201, "WM_LBUTTONDOWN")
WM_LBUTTONDOWN()
{
PostMessage, 0xA1, 2
}
If it's moveable, it cannot be "noActivated" anymore, and that's why I'm trying re-enable it somehow.
In this case, as soon as I press the 4th button, there is no way to make the Gui noActivated.
How to write it?
Code: Select all
;ClickableOnScreenKeyboard
#include Clickable_Gui_No_Activate.ahk
Gui, -Caption +AlwaysOnTop +HwndhGui
Gui, Add, Button, w150 gSendChr, a ; Sends an A
Gui, Add, Button, ys wp gSendChr, h ; Sends an H
Gui, Add, Button, ys wp gSendChr, k ; Sends a K
Gui, Add, Button, ys wp gMoveGui, Move this Gui ; When clicking, the gui can be moved
Gui, Show, NA, On Screen Keyboard Demo ; Shows gui with unique name
Gui_NoActivate(hGui) ; Implements Clickable_Gui_No_Activate class
return
SendChr:
k := GetKeyState("CapsLock", "T") ? Format("{:U}", A_GuiControl) : A_GuiControl
SendInput, % "{" k "}"
return
MoveGui:
toggle := !toggle ; Either true or false
if (toggle) ; If true:
{
OnMessage(0x201, "WM_LBUTTONDOWN") ; If lbutton down: Activate function for mouse down
}
else ; If false:
{
OnMessage(0x201, "WM_LBUTTONUP") ; When lbutton down: Activate function for mouse up -> Disable mouse down
}
return
WM_LBUTTONDOWN() ; OnMessage function for mouse down
{
PostMessage, 0xA1, 2
}
WM_LBUTTONUP() ; OnMessage function for mouse up
{
PostMessage, 0xA2, 2
}
I guess the 2nd OnMessage function isn't correct.
Thanks for any help and best regards