Windows Phone 8 manual application exit c++ - c++

I am writing a C++ DirectX application without XAML for Windows Phone 8. I have met on difficulty. In the certifications requirements it is mentioned that:
"Verify that either the app closes without error, or allows the user
to confirm closing the app with a menu or dialog."
When on the main screen user presses back button I show the yes-no dialog. When user presses Yes how should I make the app exit?
In this topic there are some solutions but they seem to work only with XAML.
http://social.msdn.microsoft.com/Forums/en-US/wpdevelop/thread/fdedf8f6-e691-4df6-92c7-ed3dc97bddc0/
How should I close the app?

Looking at that MSDN forum link it seems that the back key press logic in C++/DirectX works in the same way as C#/XAML.
I.e. If you set the handled flag command->Handled = true; in the Back key press handler the application framework will not close the app.
If you don't set the flag then the application framework will close the app.

Related

Catching ALT+TAB for the window

ALL,
We have a an application written with wxWidgets (wxGTK) and Qt.It is running on RHEL6 with FVWM window manager.
One of the window we have in that application is "Lock Screen" which is shown in the full-screen mode and does not have any decorations. The only way to get out of it should be to enter the password and press the "Authenticate" button.
However what we discover is that if the user starts up Terminal and then pulls up that "Lock Screen", (s)he can press ALT+TAB, switch to the Terminal and type whatever (s)he wants. We'd like to avoid it.
Is there any way possible to catch the "ALT+TAB" keystroke and do nothing when this "Lock Screen" window is displayed. The window is written with wxWidgets, but I'm asking about c++/Linux/gtk/qt in general.
TIA for any hints/advice community can provide.
[EDIT]
All I want is for the user to not be able to switch focus from the password field until the password is given and the "Authenticate" button is pressed.
[/EDIT]
And before you ask - there are couple of related questions on SO, which says solved, but they are for Windows/C#/WinForms/JAVA. If you can find something that will work on Linux with either GTK or Qt or maybe even FVWM internal settings I will gladly accept the answer.

Qt Disable Windows 10 Game Bar

I have an application developed in Qt that causes Windows 10 to think it is a game, and opens a pop up box that says Press the Win-key + G to open the Game bar. This is very unhelpful as my application is not a game; and it interferes with the user experience. How can I turn this off from within my application code? I have been unable to find any documentation related to this. Thanks in advance.
It is not possible to neither capture Windows shortcuts (in order to stop propagation and disable them), nor to disable game bar in a per-app base.
Options you have are:
to disable it globally (see this post): you can do it using the Registry, so it can be included in an installation package, but you'll affect the global settings of the user,
change the shortcut used to access it in the Xbox app,
use some third-party app, such as AutoHotKey, to map keyboard sequences to an empty action (related question).
Edit:
Also you can (from user side) disable it for your app in Xbox app. (Xbox support):
Open Xbox app
In my games list select your app
Right click on it and delete it
This will delete your app from games list, so GameBar will not appear.

How to know if computer is in gaming mode

Background
I'm implementing a simple WIN32 application consist of a window.
The user may show/hide the window using a special hotkey. I register the hotkey using RegisterHotKey and respond to WM_HOTKEY
Problem
if user plays a game and accidentally (or not accidentally) press the hotkey combination, then my window pops up and as a result the game is minimized.
Question
Is there a (native) way to know that the user is in gaming mode, or any other special mode, that I could disable the hotkey response
Note
I would also like if windows would make this a feature while I play games. For example don't respond to WinKey+D while I'm in gaming mode.
You can use the SHQueryUserNotificationState function to determine whether the user is playing a full screen D3D game. It will report QUNS_RUNNING_D3D_FULL_SCREEN.

How to tell if win32 c++ application lost focus after CTRL-ALT-DEL?

I've written a win32 App in C++ (a game) and I want to be able to know if the application has lost focus due to the user pressing CTRL-ALT-DEL and starting the task manager. How can I do this? What I want to do after detecting the event is to minimize the window of my game and pause its processing (animations, audio, etc.). However, if the user returns from the CTRL-ALT-DEL menu to the game then it should keep running as usual. I've thought that I could check for key presses on CTRL, ALT and DEL but that doesn't seem to work and just reacting to the lost the focus (WM_KILLFOCUS) is not what I want.
You can use WTSRegisterSessionNotification(), you'll get the WM_WTSSESSION_CHANGE message when the user presses Ctrl+Alt+Del and switches to the secure desktop.
Beware that you cannot tell that it was actually the secure desktop that he switched to, that would be rather nasty security leak. You'll also get the notification when he switches to another logon session. Also a case where you want to stop your game of course.
For that matter, a game ought to automatically pause whenever the game window loses the foreground. Nobody likes to be killed when they switch to their email reader :) Use the WM_ACTIVATEAPP message

How to record keystrokes when keyboard journaling is not available?

Having setup C++ app originally using MS specific keyboard journaling hook (WH_JOURNALRECORD) we find that it does not work on Vista unless run as administrator with uiAccess enabled. MSDN Question - Journaling hooks on Vista?
We want to record a key sequence from the user in a friendly way that will be repeated at some later date. The user presses a record button, a dialog is displayed with a stop button and the recorded keys.
One advantage of using the journaling hook was that you only got keystrokes which did something. Holding down shift didn't report 100 shift keys, but did report usage when you hit a letter.
Another advantage was that you could set the focus to an area outside of the application, say another applications window, and record the action as the user interacted.
Asides from making the keyboard capture part of the existing app a separate executable which runs as administrator with uiAccess, I'm seeking other ideas on how to record keystrokes that work on windows for 2K, 2K3, 2K8, XP, Vista.
Edit: I know there is a security concern with just recording anything, obviously if you could do such a thing without the users notice you have your typical keystroke logger for hacking purposes. Soooooo.....
Is there a way to make journaling work, for this user, and their apps, running at the same level (or lower) and capture keystrokes? having it popup the vista security are you sure dialog would be allright, but the process cannot be marked with uiAccess (otherwise it won't interact properly with the rest of the system) and it will in 98% of cases be run by users without rights to elevate to administrator.
Even if you could, you'd probably would find Microsoft fixing that bug in the next patch. The change in Vista was intentional, and there's a clear way (uiAccess==true) to still do what you want.
We have worked around the main issues by using SetWindowsHook instead.
const HMODULE hDLL = ::GetModuleHandle(DLL_NAME);
::SetWindowsHookEx(WH_KEYBOARD_LL, myKeyboardProcCallback, hDLL, 0);
The callback now has to manage the keystroke information and translating it into usable sequences - ie don't record multiple ctrl presses when heeld down to press ctrl+key.