For example if you place the cursor in the middle of the GUI and then move the cursor over the right edge and outside the GUI, it sends a command. Now if you move the cursor outside of the GUI by crossing over the top edge, it sends a different command, and so on. Clicking down on the GUI and dragging will move the GUI around the screen.
My question: sometimes when you move the cursor outside of the GUI slowly, it misses the command, requiring you to do it again.
Is there a way to have it so that it will always detect the cursor moving outside of the GUI, regardless of how fast the cursor is moving?
Code: Select all
#NoEnv
#NoTrayIcon
SetBatchLines, -1
Coordmode, Mouse, Screen
Gui, +Resize -Caption +AlwaysOnTop -0x30000 -SysMenu
Gui, Color, 996666
Gui, Show, w150 h150, PANEL
winmove, PANEL,, 200, 500
OnMessage(0x201, "WM_LBUTTONDOWN")
OnMessage(0x200, "WM_MOUSEMOVE")
Return
WM_MOUSEMOVE() {
wingetpos, winX1, winY1, W1, H1, PANEL
MouseGetPos, X1, Y1
Sleep, 1
MouseGetPos, X2, Y2
GUIHeight := winY1 + H1
GUIWidth := winX1 + W1
GUIWidthRightEdge := winX1 + W1
GUIWidthRightEdge -= 25
GUIHeightBottomEdge := winY1 + H1
GUIHeightBottomEdge -= 25
winX1 += 25
winY1 += 25
If (X2 > X1) and (X2 > GUIWidthRightEdge) and (Y2 > winY1) and (Y2 < GUIHeight) ;glide cursor from inside GUI to outside right edge
{
tooltip, right
X1 := X2
W1 := W2
}
If (X2 < X1) and (X2 < winX1) and (Y2 > winY1) and (Y2 < GUIHeight) ;glide cursor from inside GUI to outside left edge
{
tooltip, left
X1 := X2
W1 := W2
}
If (Y2 > Y1) and (Y2 > GUIHeightBottomEdge) and (X2 > winX1) and (X2 < GUIWidth) ;glide cursor from inside GUI to outside bottom edge
{
tooltip, bottom
Y1 := Y2
Y1 := Y2
}
If (Y2 < Y1) and (Y2 < winY1) and (X2 > winX1) and (X2 < GUIWidth) ;glide cursor from inside GUI to outside top edge
{
tooltip, top
Y1 := Y2
Y1 := Y2
}
}
return
WM_LBUTTONDOWN() {
PostMessage, 0xA1, 2,,, A
return
}