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.
Related
I'm writing a cross-platform Gtk3 application in C++. Lately I've been working on the integration with MacOS:
Gtkmm 3.24 obtained via Homebrew;
XCode 12.0;
MacOS Catalina 10.15.
I have derived my application class from Gtk::Application. The application object overrides the 'on_startup()' which calls the base class 'on_startup() and then uses a Gtk builder resource to construct a Gio::Menu object from an XML file, and then 'Gtk::Application::set_app_menu()' to install it:
MyApplication::on_startup()
{
Gtk::Application::on_startup();
// skipping details: ... Gtk builder reads Gio::Menu object from resource file ...
set_app_menu( pMenu );
}
When I first launch my application:
the menu bar is unresponsive. The application menu appears next to the Apple menu in the bar at the top of the screen, but neither responds to mouse clicks;
except from the frozen menu bar, the application is functioning normally and its main window is responsive.
However, then:
click on any other open application's window, that application's menu bar appears;
click on my application's window to switch back to it, its menu bar returns and now works perfectly.
This is 100% reproducible (frozen at first, toggle away to another app and back and now the menu works).
I created another project in XCode and built the Gtkmm example "app_and_win_menus" and the example application behaves the exact same way.
So I think I'm really just looking for a workaround. I've been scouring the net for any information about this problem and saw others complaining generally about frozen menu bars on MacOS but none specific to Gtk (all other applications on this Mac work normally, it's only the apps that I build with Gtk+/Gtkmm 3.24 that exhibit this issue).
I realize this sounds a bit like a bug report and this may not be the place to bring it up, but I'm unsure where to go from here. Any information much appreciated.
I would like to open a new browser tab using C++ on Windows, ideally browser-independent, if that is not possible chrome is good enough.
But there are some restrictions:
The current application can not lose focus, but the browser must switch to the new tab.
The tab must be opened to a specific URL
The tab must be opened from a 3rd party application, so not from inside the browser.
I have tried using system("start <url>") but that causes the application focus to switch to the browser. I could not find a chrome:// URL to open a new tab with an initial URL.
I have also found several threads showing similar things in JavaScript, but none for C++.
Is there a way (ideally safer than using system()) to open a new browser tab without losing focus on the current application, using C++ on windows?
Additional clarification:
3 windows open: One game, the browser and a 3rd party application.
The game is in the foreground, but the 3rd party application opens the browser tab on certain events. Sadly, this means that DLL injection is not an option, due to several anti-cheat restrictions. This also means that a background application needs to open a new browser tab of a browser that is also in the background without ever losing focus on the game.
I'm trying to prevent the app from being closed by clicking the Close box on the App Window.
For example, having a text editor with unsaved changes, upon pressing Close Box, I would first display, "Do you want to save changes before exiting?"
How can I detect app wanting to close and prevent that from happening?
I'm using C++, and this needs to be for Windows 10 Universal Apps UWP.
I already know how to do this for Win32.
The comments are correct. There is currently no way for a regular Store app to do this.
However, with the Creators Update (and corresponding SDK) we have included a preview API that you can now check out for this functionality:
The Windows.UI.Core.Preview.SystemNavigationManagerPreview class provides a CloseRequested event that an app can mark as handled. For the event to work the app will need to declare the restricted 'confirmAppClose' capability per:
https://learn.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations
Please let us know your feedback.
Thanks,
Stefan Wick - Windows Developer Platform
On devices with touch input Windows 10 displays nice touch-friendly menues, so i'm looking for a way to add this into my application. Is there any new flag or a method to show such a menu without making it completely owner-draw?
The control you are referencing is a MenuFlyout. Depending on whether you're using a mouse or touch, Windows 10 will automatically space the menu items closer/further to be optimal for the input you're using.
To use this control (the easy way), your app should be a Windows 10 Universal (UWP) app, which can be written in C#, VB and C++.
You can find official samples for UWP apps on GitHub.
I am on RHEL 6 and am creating an app using C++ and QT. I am trying to make my window/app be on top and be the only app the user can interact with.
I have set:
setWindowFlags(Qt::WindowStaysOnTopHint);
But the user can still click on a different app, which then comes to the top. I need to prevent that.
I was able to fix it by adding "show();" after I set the windowFlags.