SoundBeep after GUI moving?

Get help with using AutoHotkey and its commands and hotkeys
john_c
Posts: 319
Joined: 05 May 2017, 13:19

SoundBeep after GUI moving?

15 Jul 2018, 11:11

As I know there are only 5 GUI events: GuiClose, GuiEscape, GuiSize, GuiContextMenu and GuiDropFiles.

However, I need something different. Simply saying I want something like this: Wait until user move GUI somewhere (by dragging it with mouse) and then, after it was moved, do SoundBeep.

Is there a way to achieve it?
Qysh
Posts: 143
Joined: 24 Apr 2018, 09:16

Re: SoundBeep after GUI moving?

15 Jul 2018, 11:17

Maybe Something like this

Code: Select all

Gui, Add, MonthCal, x2 y9 w360 h310 , 
Gui, Show, w365 h320, MyGui
return

~$*LButton::
WinGetPos, guiXold, guiYold,,, MyGui
return

~$*LButton Up::
WinGetPos, guiX, guiY,,, MyGui
if(guiXold != guiX or guiYold != guiY)
	SoundBeep, 500, 500
return
john_c
Posts: 319
Joined: 05 May 2017, 13:19

Re: SoundBeep after GUI moving?

15 Jul 2018, 11:50

Qysh wrote:...
Thanks. Yes, I understand, it works correctly, but in my real code I cannot use mouse keys for it. Probably there is another way for it?
ssh003
Posts: 4
Joined: 15 Jul 2018, 05:34

Re: SoundBeep after GUI moving?

15 Jul 2018, 13:22

How about using with settimer?

Code: Select all

Gui, add, text, ,text
Gui, show, , MyGui
WinGetPos, GuiXold, GuiYold, , , MyGui
SetTimer,MyGuiCheck,10
Return

MyGuiCheck:
WinGetPos, GuiXNew, GuiYNew, , , MyGui
If (GuiXOld != GuiXNew or GuiYOld != GuiYNew)
     SoundBeep, 500, 500
GuiXOld := GuiXNew
GuiYOld := GuiYNew
Return

I wrote down this code from the mobile without any check just from in my memories
So it could be not perfect but i think you could understand it probably
User avatar
Alguimist
Posts: 347
Joined: 05 Oct 2015, 16:41
Contact:

Re: SoundBeep after GUI moving?

15 Jul 2018, 15:08

All you need is WM_EXITSIZEMOVE:

Code: Select all

Gui Show, w481 h381, Window

OnMessage(0x232, "OnWM_EXITSIZEMOVE")
Return

OnWM_EXITSIZEMOVE(wParam, lParam, msg, hWnd) {
    SoundBeep 500, 500
}

GuiEscape:
GuiClose:
    ExitApp

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], Gully, joefiesta, labrint, leo007, Mike_Fay, SuperFoobar, Trymado and 80 guests