Disabling Windows 10 Game Bar for specific application - windows

In some conditions the Windows 10's game bar opens up with my application (made with Delphi, VCL). Thats not a game and i don't directly use DirectX or OpenGL, but it opens up.
To be specific, when i reduce to tray my app and a popup is opened the Game Bar appears.
I found a numbers of sites with tutorial for totally disable the Windows 10 game bar (like this) but i want to disable for my application only, i don't think users will be happy to have a windows feature silently disabled by my app
Is this possible? I cannot find any documentation about it

You can disable it following this solution :
Press Win+G, click the Gear icon (Settings) and uncheck "Remember this is a game" (https://superuser.com/questions/1086248/windows-10-xbox-dvr-app-thinks-chrome-is-a-game).
Note that if the name of the application is Main.exe, this checkbox is not visible.
If the name of the app is main.exe or anything else, it is visible.
It seems it is stored in the registry : HKEY_CURRENT_USER\System\GameConfigStore\ in the Children and Parents directories.
You can try to find your app using the ExeParentDirectory key.
https://www.reddit.com/r/ffxiv/comments/3fbu0x/win_10_game_bardvr_anyone_having_issues/
I don't know if it applies to an executable where Windows decides it is a game (like Main.exe)

Related

Strange windows window panel

I'm developing an application for the game window but I encounter a strange issue. About 5% of users have different top window panels of the game. In the attachment, you can see the normal window panel and Incorrect (different) version. Every user uses Windows 10 and has the same version of the game application. I'm not sure but on the right side of the incorrect window panel, there is some old-styled leftover (kind of) off minimize/fullscreen/exit buttons. Does anyone know what may cause this strange problem? Maybe they need to change some windows settings, so their game window will look like a Normal window panel?
Window panel example

Metro to desktop to metro.. API?

On Windows 8 they've replaced the Start Menu with a Start Screen using Metro GUI.
Desktop applications can be run from this screen, but when they exit the user is left at the desktop.
Is there a Windows setting that will return to the Start Screen automatically when the application is closed, if it was launched from Metro?
Or is there an API available so that the application itself can detect whether it was launched from Metro and then switch back to it as it is shutting down?
(I want something automatic or programmatic. "Press the Windows key" is not an acceptable solution.)
Window 8 metro GUI is working like Start menu so I will change my application's setup program to put some command line options for desktop menu shortcut and pick it up from Param array.
When closing I would try sending Windows button combination (Ctrl+Esc) to windows. Actual code to do that depends on the language used to develop your app. If developed in .Net following class can be helpful
System.Windows.Forms.SendKey.Send
http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx
following library may also be useful
http://inputsimulator.codeplex.com/

Start external exe within own process

I have a VB6 executable we use as a Starter executable for our real program.
The problem is that windows 7 shows a new icon in the taskbar for the new process, instead of the one i clicked on to start my program (of course, because the starter exe has already ended, and the new exe seems to be a new program).
Currently I use the Shell object to start the other exe. Is there a better way to do it from vb6, maybe by using a native C function with declare that does start an exe in the current process, without spawning a new process?
EDIT:
Thanks to atzz for the great information about Application Model IDs. I now have a shortcut to my app starter with a well defined id, and my app also sets the ID when started, and is now accesssible beautifully from the right icon in the toolbar. However, two problems persist:
The app is a Java App started with Exe4J, and I don't have any chance to set the AppID before Exe4J shows the splash screen, so while showing the splash screen there is a second icon in the taskbar.
If I don't manually drag my starter app icon from the Desktop to the toolbar, but instead use my apps icon and set it to be "sticky", the real app is sticked, and not the launcher.
Both problems would be beautifully solved if my launcher would start the app from within its own process. I heard something of using exec() instead of fork() for linux programs to achive this... is there something similar for windows?
I believe there is a way to accomplish what you need via Windows 7 taskbar API, though I never did it myself and thus don't remember clearly enough what I've read on the subject. Look around the Application ID concept.
Some links:
Developing for the Windows 7 Taskbar – Application ID
Inside Windows 7 - Introducing The Taskbar APIs
If the problem is the icon, why not give both programs the same icon (and the same App.Title). Then the user won't be able to tell the difference between the two taskbar entries. Presumably they aren't both visible at the same time.
Alternatively set your starter app not to appear in the taskbar (Form property ShowInTaskbar = False in the design view)

Does Windows 7 treat full-screen applications differently?

I have a hidden process that waits for non-standard hardware button messages and runs an application (with CreateProcess). No problem with the user disturbing, it's an action that the user approved himself. Everything is fine when it's usual layout with taskbar shown and multiply captioned and non captioned- windows. But the situation is different in XP and 7, when the current application is full-screen. Full-screen application in this case is window without borders having exactly the same dimension as the screen. Windows hides taskbar for such application even if it's always on.
In Xp, it's ok, the taskbar is being shown in this case and appication (for example calculator) also, the full-screen app is still visible in areas other than the launched app's and taskbar'. But in Windows 7 nothing visual happens, the full-screen app is still on and if I switch to taskbar, the executed application is there. I tried to solve it with SetForegroundWindow, BringWindowToTop, even AllowSetForegroundWindow(GetCurrentProcessId()) call for a window handle found with CreateProcess-WaitForIntputIdle-EnumThreadWindows, no change. So did something change since XP related to full-screen windows that officially documented?
Thanks,
Max
I would imagine that, if you have your own hardware device, that there is some API for generating "real" user input. Clearly the legacy keyboard and mouse, and now USB HID drivers (many of which are usermode I think?) have access to an API to do so.
Synergy+ for example can generate fake keyboard and mouse events on connected PCs, and the consequence of the faked input is windows switching activation normally.
So, my initial idea is for your usermode "Device" application to synthesize actual keyboard messages - SendInput seems a likely candidate for "the API that can "fake" real user input events.
Then, use an API like RegisterHotKey in your "UI" app to respond to the hotkey combination your device app generates.
Now, (assuming that SendInput IS generating user input events at the correct level), you should (from within the WM_HOTKEY handler in your UI app) have permission (because everything was "user initiated") to change the foreground window (to yourself).
Vista introduced the desktop composition feature. In short, all windows are drawing to a memory bitmaps and the Desktop Window Manager is then composing these bitmaps and drawing on a full-screen Direct3D surface. Full-screen windows do not participate in the desktop composition and get to draw directly on the screen (mostly because the majority of full-screen apps are games that need real-time screen updates).
In particular, this means that when a full screen app is up and running, it is covering the DWM composed image and the user needs to switch to a DWM-managed window for the DWM to start drawing on top of the full-screen app.
I don't have a good solution for your problem, unfortunately. One way to solve it would be to add the WS_CAPTION style to your app and then handle WM_NCPAINT/WM_NCCALCSIZE/WM_NCHITTEST yourself. This would allow you to lie to the DWM that you are a regular windowed application, but change visually your NC area to look like you have no title. However, this does require certain amount of additional code and might be a bit more effort you want to invest.
Another way you can try to solve your problem is to explicitly minimize your full-screen application window when launching the new process. However, you will then have to solve the problem of when to maximize it back again.
Btw, you might find the comments on this post from Raymond Chen interesting.
Windows supports multiple desktops and my guess would be that the full screen up is using a different desktop than the default one (where your application will be shown). A desktop object in Windows is "a logical display surface and contains user interface objects such as windows, menus, and hooks". For example, screen savers normally are started on a separate desktop.
You can find out which desktop an application is running on using Process Explorer:
Set Process Explorer to replace Task Manager and to run always on top.
When your full screen up is shown, launch Process Explorer by pressing Ctrl + Shift + Esc
Within Process Explorer, select the full screen process and press Ctrl + H to display the handles of this process
See the value of the Desktop item in the list. Usually this would be set to Default
If you know what desktop this app is running on you can start your process on the same desktop by first calling OpenDesktop to get a handle to this desktop and then pass it into the STARTUPINFO of your CreateProcess call.

How to assume/steal another process's windows as my own?

I'd like to show another app's windows under my app's taskbar button. It's a background app that reports another process's windows as my app's own. Is there any universal way to do this, e.g. each "new" window, alert glow, progressmeter, and other taskbar features, show under my own app's button?
For example, Winfox runs under its own process and steals Firefox's windows. It also adds features, but that's irrelevant -- I just want to support another app's existing taskbar features under my own app's button -- multiple windows, progressmeter, alert flashing, error flashing, mini-icons, etc. Is there a near-universal way to steal an app, or is it largely app-specific? Thanks!
You should be able to use SetParent() to take ownership of a window, but I'm not sure how much this will help you in your attempt to add taskbar features to the legacy app.

Resources