StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General Discussion
 General Discussion
 Close window
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Surenpahlav

8 Posts

Posted - 01/30/2019 :  12:36:05  Show Profile  Reply with Quote
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
2530 Posts

Posted - 01/31/2019 :  06:33:17  Show Profile  Visit Rob's Homepage  Reply with Quote
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)
Go to Top of Page

Rob

USA
2530 Posts

Posted - 01/31/2019 :  06:36:57  Show Profile  Visit Rob's Homepage  Reply with Quote
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.
Go to Top of Page

Surenpahlav

8 Posts

Posted - 01/31/2019 :  09:36:44  Show Profile  Reply with Quote
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.
Go to Top of Page

Rob

USA
2530 Posts

Posted - 01/31/2019 :  09:47:46  Show Profile  Visit Rob's Homepage  Reply with Quote
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
Go to Top of Page

Surenpahlav

8 Posts

Posted - 01/31/2019 :  11:14:33  Show Profile  Reply with Quote
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.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000