Author |
Topic |
|
Surenpahlav
20 Posts |
Posted - 01/30/2019 : 12:36:05
|
Close window stroke randomly causes explorer to crash (restart) when stroked on an explorer window (not any program other than windows).
I use this code to close the current window: acCloseApplication(nil, gsx, gsy)
both:
acSendControlDown()
acSendKeys("w")
acSendControlUp()
and: acSendKeys("%{F_4}")
only work if the current window is focused, so I don't use those.
What can cause this?
|
|
Rob
USA
2615 Posts |
Posted - 01/31/2019 : 06:33:17
|
See this thread to activate the window first: https://www.strokesplus.com/forum/topic/316/dyk-acsendkeys-and-window-focus?SearchTerms=acactivatewindow
Also, you can set this to happen for all actions, as described from this thread: https://www.strokesplus.com/forum/topic/314/actions-occur-to-focused-window
quote: Don't forget you can utilize the sp_before_action function in Global Lua to always activate the window below where the gesture began: function sp_before_action(gnm, gsx, gsy, gex, gey, gwd) acActivateWindow(nil, gsx, gsy) end It will fire before all actions (not those defined in the Hotkey tab, though)
|
|
|
Rob
USA
2615 Posts |
Posted - 01/31/2019 : 06:36:57
|
Oh, and the reason is because you're sending a message to the shell (Explorer, which is Taskbar, Start, etc) to close since it would be the active/foreground window. |
|
|
Surenpahlav
20 Posts |
Posted - 01/31/2019 : 09:36:44
|
Thanks the first code worked!
But the 2nd code "for all actions" did not work on its own without the first code. I tried putting it in global Lua and sending alt+f4 on the close action when the window was not focused, it just brought up the shutdown dialog of Windows 7. |
|
|
Rob
USA
2615 Posts |
Posted - 01/31/2019 : 09:47:46
|
First, make sure you only have on instance of sp_before_action in your Global Lua. If you copied and pasted the above in and the default placeholder was already there, it wouldn't work right.
Also, it looks like I expanded the parameter list at some point. So, find any sp_before_action functions in Global Lua and remove them, replace with this and see what happens.
function sp_before_action(gnm,gsx,gsy,gex,gey,gwd,gapp,gact,gbl,gbt,gbr,gbb) acActivateWindow(nil, gsx, gsy) end |
|
|
Surenpahlav
20 Posts |
Posted - 01/31/2019 : 11:14:33
|
Mmm okay the 2nd code has no effect on anything. Also the first code only works half the time when alt+f4 is used for closing window, the other half it will bring up the shutdown dialog as usual.
But anyway if it works with acCloseApplication(nil, gsx, gsy) without crashing explorer.exe then I'm happy. It only happens randomly anyway so I haven't had the time to fully test it yet. |
|
|
|
Topic |
|
|
|