"winclose" not working in Windows 10?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
wdmodlin
Posts: 150
Joined: 16 Dec 2015, 02:42

"winclose" not working in Windows 10?

30 Jul 2016, 12:08

I just migrated to windows 10. Painful process, had to get new drivers for video card and several other things... but mostly have stuff working now I think.

But my game-monitoring app can no longer close the game windows. Here's the relevant code:

Code: Select all

Close_isN:
Gui +OwnDialogs
MsgBox 0x40004, ,Close_isN, Do you want to close all InnerSpace game windows?
ifMsgBox Yes 
{
	loop %nAccounts% {
		Win := WinIDstr(A_index)
		if WinExist(Win)
		{
			OUTPUTDEBUG,% "ISM: CLOSING " Win
			WinClose
		}
	}
}
NextUpdate := 1
return
The OUTPUTDEBUG messages show the expected partial window titles for game windows running under ISBoxer. EG "is1 (Ctrl+Alt+1)".
Previously, under WIN7, the close messages would cause the game sessions to camp to desktop, exiting the game. Now, under Win10, nothing visible happens in response to the WinClose. If I manually close the game window by right-click on taskbar icon and selecting close, it still works as expected. And other AHK functions such as WinActivate used in a similar loop still work. But the WinClose does nothing.

Any suggestions? Any idea why this might not work?
User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: "winclose" not working in Windows 10?

30 Jul 2016, 17:50

You could try one of the following:
PostMessage, 0x112, 0xF060,,, %Win%
WinKill
wdmodlin
Posts: 150
Joined: 16 Dec 2015, 02:42

Re: "winclose" not working in Windows 10?

30 Jul 2016, 20:43

boiler wrote:You could try one of the following:
PostMessage, 0x112, 0xF060,,, %Win%
WinKill
Thank you! The PostMessage works.

WinKill has no visible effect, just like winclose.

While your suggestion solves my particular problem I don't want to mark the thread "solved" yet, as I hope that someone with more understanding than I can address the question of why WinClose is no longer working, and perhaps fix it. Along with any other related problems that I have not yet encountered.
WatsonEnterprises
Posts: 19
Joined: 25 May 2020, 23:04

Re: "winclose" not working in Windows 10?

09 Sep 2020, 04:24

I had this same problem of WinClose not working on Windows 10, when it had previously worked on Windows 7. (The PostMessage method above worked when WinClose did not.)

I was able to fix the problem by right-clicking AutoHotkey.exe in explorer > Properties > Compatibility tab > put checkmark in "Run this program as an administrator". After doing that and restarting AHK, WinClose started working correctly.
pafu
Posts: 1
Joined: 24 Jul 2021, 05:59

Re: "winclose" not working in Windows 10?

24 Jul 2021, 06:03

WatsonEnterprises wrote:
09 Sep 2020, 04:24
I had this same problem of WinClose not working on Windows 10, when it had previously worked on Windows 7. (The PostMessage method above worked when WinClose did not.)

I was able to fix the problem by right-clicking AutoHotkey.exe in explorer > Properties > Compatibility tab > put checkmark in "Run this program as an administrator". After doing that and restarting AHK, WinClose started working correctly.
that was actually helpful. thank you sir!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 383 guests