How to intercept window events

Ask for help, how to use AHK_H, etc.
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

How to intercept window events

28 May 2017, 04:58

I tried using the event message to intercept the destruction of the window, but that did not seem to take effect:

Code: Select all

gui,+hwndhwnd
Gui, Show,w200 h200
OnMessage(0x0002, hwnd,"winClose")
return

winClose(wParam, lParam){
	return 1
}

How can we intercept this event?

I know that can use the "GuiClose" tag, I just need an example of an intercept event.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to intercept window events

28 May 2017, 05:59

That's alright, you Gui is just not distroyed:

Code: Select all

gui,+hwndhwnd
Gui, Show,w200 h200
OnMessage(0x0002, hwnd,"winClose")
return
GuiClose:
  Gui,Destroy
Return
winClose(wParam, lParam){
  MsgBox
	return 1
}
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: How to intercept window events

28 May 2017, 06:10

I solved the problem, the need to monitor the message number should be: 0x0010
thank you. :D

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 36 guests