How to resize Metro window? - c++

How do I programatically make Metro windows fullscreen in 8.1 with C++?
I have tried this but it doesn't work and always returns false:
Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->TryUnsnap();
Also, the docs say it's deprecated.
Thanks.

I do not believe this is possible; it is always the user's choice through interaction with the Metro shell to view your application at the size they desire. Your application cannot programmatically change that (otherwise you could implement a program that behaved maliciously).

Related

Override Close Box on Windows 10 Universal Apps UWP

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

Prevent a Windows app from stealing the focus

I have created a windows application in C++ and I want to make so whenever I run it, it doesn't steal focus from whichever window is currently focused(or maybe steal the focus and give it back right away). I'm not creating any window so i'm not sure how to change the window style, my program runs in the background.
I couldn't find any answer that worked for C++, is there any way I can do this?
When you start your application by clicking on the EXE or shortcut, Windows Explorer takes focus, not your app. The only way to start your app and not let Windows Explorer take focus is to start your program when Windows starts, via registry key.
Make sure you use the extended style WS_EX_NOACTIVATE when using CreateWindowEx().
See the Microsoft Docs for CreateWindowEx.

How to hide the Taskbar on Windows 8 programmatically on a normal user environment?

I use the following code to hide the taskbar:
ShowWindow(FindWindow(L"Shell_TrayWnd",L""), SW_HIDE);
This works when I run the program on a user with Administrator rights. However, when I run the same code on normal user account, it doesn't work (the taskbar is not hidden). What should I do to fix this?
The first question to ask is "why are you trying to hide the taskbar"? If the answer is "because I want my application to run full-screen", then do just that: create a full-screen window. See http://blogs.msdn.com/b/oldnewthing/archive/2005/05/05/414910.aspx for details.
If you're trying to hide the taskbar for other reasons, don't. It's a standard part of the Windows UI, and whether it's shown or hidden (or auto-hidden) is a user-setting, not something your app should be changing.

on top Qt application in windows

How can I make my application always be on top meaning that the user couldn't access start menu or desktop in Qt or any other possible c++ way?
Also i need it to start right after the login progress , more like a new gui for windows , a simpler one
QWidget::setWindowFlags(Qt::WindowStaysOnTopHint) should do the trick. Note that on some window managers on X11 you also have to pass Qt::X11BypassWindowManagerHint for this flag to work correctly.

Which On-Screen Keyboard for Touch Screen Application?

I'm developing an application in C++ that's partially driven by touch-screen on Windows XP Embedded. Some text entry will be necessary for the user. So far we've been using the standard Windows On-Screen Keyboard (osk.exe), but there are two main problems:
It's rather small on a higher resolution screen which will probably make it hard for users to hit the right keys
It's too "ugly" for the customer, who'd like a slicker on-screen keyboard that integrates better with the custom look-and-feel of the application so far.
Therefore I'm looking for alternatives for the Windows On-Screen Keyboard (osk.exe) that allow a larger size of buttons and can be skinned. Ideally it would have a BSD-like license for unburdened integration into a commercial app, but a royalty-free commercial solution could work.
Do you know of any such applications, or have you had a similar project where you solved the issue in another way?
We are using Click-N-Type for our systems. It is completely resizable. It has some customization possibilities, but I never tried them. We use it on "normal" Windows XP, but it should work on Windows XP embedded also.
I know this question is tagged 'c++', but here's an option for .Net that I found and integrated with less than 5 minutes work. (I've looked, and there isn't a .Net flavour of this question, and I guess it could be ported to C++ with very little effort too).
It uses the standard Windows On-Screen Keyboard (osk.exe), resizes it, docks it to the bottom of the screen and removes the title and menu bars, all from one call in your application.
The Code Project - Manage Windows XP On Screen Keyboard
The download is a single VB.Net class.
please check WPF Component(http://fpscomponents.com/Product.aspx?id=8) that is fully customizable by inbuilt editor. So programmer can fill it with own language and define layout!
Check johngnazzo code:
http://www.daniweb.com/forums/thread4548.html#
Why not write your own keyboard UI? This would (should) be relatively trivial and give you complete control over its look and feel.
I programmed a On Screen Keyboard in Java.
This is working very fine when you want to tip into Java components and Java frames.
When you want to tip in every open window you have to send the key event by implementing Robot sender. The problem i have is that the focus owner get the sended key and when you open the keyboard the keyboard has the focus.
You can not realy implement a global Java keyboard, as far as i know.
When you only want to use the Keyboard for Java, use Java.
Otherwise you should use another language.
You should use a native language where you can handle the OS focus owner or a language where you can completly disable the keyboard focus but also can bring the keyboard to the front of the screen
Take a look at chessware virtual keyboard.
http://hot-virtual-keyboard.com/