This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

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

 All Forums
 Bug and Issues
 Known Issues
 acCloseApplication when closing Metro apps
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

aoeui

4 Posts

Posted - 10/26/2013 :  00:55:39  Show Profile
I'm using Windows 8.1 RTM.

I use
acCloseApplication(nil, gsx, gsy)
to close programs. For desktop programs, it works fine. But for Metro apps, it seems that the apps are actually crashed, not closed, because you can move your mouse to upper-left corner of the screen, you can still see your last app (without thumbnail, looks like just crashed).

Now I use
acSendKeys("%{F_4}")
instead, that is Alt+F4.

But Alt+F4 has a different effct than acCloseApplication. Alt+F4 closes the current foreground window, but acCloseApplication closes the window under the mouse cursor.

Rob

USA
2615 Posts

Posted - 10/26/2013 :  17:43:46  Show Profile  Visit Rob's Homepage
By default, Metro apps are suspended if they're not active (currently have focus). I used Spy++ to identify the proper keycode sequence to post which simulate ALT+F4, but unless the Metro App currently has focus, the messages are ignored. So basically, using acSendKeys("%{F_4}") is the only method to properly close a Metro app, but it must be active.

Also, note that WM_CLOSE does effectively crash the app, which gives the app a reported crash; too many crashes and an app may be reviewed by Microsoft, so I highly recommend using a modified script to check if the process is a Metro app and send ALT+F4 instead of acCloseApplication():
if acIsImmersiveProcess(acGetOwnerWindowByPoint(gsx,gsy)) == 1 then
	acActivateWindow(nil, gsx, gsy)
	acSendKeys("%{F_4}")
else
	acCloseApplication(nil, gsx, gsy) 
end
Of course, the script above doesn't consider the window's current focus/active state, but is just for illustrative purposes.

EDIT: Added call to activate the Metro app before sending ALT+F4...seems to work well on my initial testing.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000