Where is documentation for Core App C++/WinRT? - c++

I am trying to develop apps in Core App C++/WinRT. I notice that it has a wWinMain entry point, so I am assuming it supports code from Windows Desktop Application. I cannot find documentation specific to Core App C++/WinRT. Should I be using the W32 documentation on msdn? When I try to add sample code from Windows Desktop Applications I cannot access header files such as winuser.h. I am using Visual Studio 2022, so the windowsapp.lib should already be included (I have also tried adding the windowsapp in a pragma comment directive). Can someone help?

Core App (C++/WinRT) is a project template for a Universal Windows Platform (UWP) app that doesn't use XAML. Instead, it uses the C++/WinRT Windows namespace header for the Windows.ApplicationModel.Core namespace. After building and running, click on an empty space to add a colored square; then click on a colored square to drag it. You could know about this from the document: Introduction to C++/WinRT.

Related

Xbox 360 Wireless Controller is not working via C++/WinRT and Windows.Gaming.Input API in console application

I trying to use Windows.Gaming.Input API via C++/WinRT from Windows Console Application and it is not working as supposed with Xbox 360 Wireless Controller (reported as Xbox 360 Wireless Receiver for Windows (0x045e:0x0000)).
I got GamepadAdded event, then trying to read gamepad state via gamepad.GetCurrentReading() and seems GamepadReading struct is not filled at all for Xbox 360 Wireless Controller.
Also I found that there is some strange error message on MSVS debug console:
onecoreuap\xbox\devices\api\winrt\pnpdevicewatcher.cpp(500)\Windows.Gaming.Input.dll!00007FFE453AABC7: (caller: 00007FFE453AA367) ReturnHr(1) tid(4e04) 80070006 The handle is invalid.
Xbox One Game Controller (0x045e:0x02d1) is working fine though.
What is wrong with my code? Or this is bug in Windows?
Code is here: https://github.com/DJm00n/cppwinrtgamepad
Using Windows 10 1809, MSVS 2017 15.9.9, cppwinrt v1.0.190211.5, Windows SDK v10.0.17763.0, xusb22.sys v10.0.17163.1, xboxgip.sys v10.0.17163.1.
PS: I also tried UWP Simple3DGameXaml app from https://github.com/microsoft/Windows-universal-samples repo - and both controllers works in it.
This is a known issue. Apparently this is caused by how focus handling works. Windows.Gaming.Input basically doesn't work for console apps as a result, but does work for Win32 or UWP apps that have a window in focus.
Note that the one case where the Xbox One controller worked for you is only because both the user was an admin -and- because you had developer mode enabled. It wouldn't work from a console app at all otherwise.
If you need game controller support for a legacy Win32 console app, you should use XINPUT. See this blog post.
In order to help us investigate this issue more clearly, could you please share your Visual Studio 2017 version to us? You can get version info selecting Help -> About Microsoft Visual Studio, then selecting Copy Info from the right side of the About dialogue.
Could you please check if you can reproduce this issue on 1903 with SDK 18362?
By the way, it will be better if you can upgrade your project dependencies as well, what you are using is an old version of the Microsoft.Windows.CppWinRT NuGet package: 1.0.190211.5. The current latest stable version is v2.0.190722.3.
Besides, the C++ Language Standard was set in project properties, but the value was not set. This should be set to ISO C++17 Standard (/std:c++17) under Project Properties -> C/C++ > Language > C++ Language Standard.
Thanks for your collaboration.

VS2019 + Xamarin.Forms = UWP/EXE dropped?

How do I get the UWP back into Xamarin.Forms Cross-Platform creation to have the templates ready to roll?
After picking through the release notes, playing with VS2019's UI and a few hours of web searching, I have only found others posting about the problem in the preview versions. Some say UWP is gone forever, some say it just isn't included by default (so Microsoft can brag about how the install went from 23GB to 8GB or something like that) - but no help on HOW TO re-enable it, or add it to the project creation wizard (apart from adding a blank UWP project sans all code that is in the iOS/Android projects).
<Project Sdk="Microsoft.NET.Sdk">
// the code is not the problem here,
// getting TO the code is the problem
</Project>
EXPECTED:
In VS2017, Xamarin.Forms Cross-Platform supplied iOS + Android + UWP templates by default.
ACTUAL:
Visual Studio 2019 seems to have removed the UWP template from Xamarin.Forms Cross-Platform project creation.
Update 9 apr.: a new version of 2019 was released which reinstates the UWP templates again
It is correct that the UWP template is removed from VS2019, I don't know the reason behind it, but we'll have to deal with it. There is however a page that runs you through the process step by step. It has been there for a while for the projects that were created in Visual Studio for Mac, which don't include the UWP template as well. The full description can be found here: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/windows/installation/ taken from this page:
First, right-click on the solution and select Add > New Project... and add a Blank App (Universal Windows) project:
Then, select the minimum and targeted UWP versions.
Right-click on the UWP project and select Manage NuGet Packages... and add the Xamarin.Forms package. Ensure the other projects in the solution are also updated to the same version of the Xamarin.Forms package.
Also, make sure the new UWP project will be built in the Build > Configuration Manager window (this probably won't have happened by default). Tick the Build and Deploy boxes for the Universal project:
Right-click on the UWP project and select Add > Reference and create a reference to the Xamarin.Forms application project (.NET Standard or Shared Project).
In the UWP project, edit App.xaml.cs to include the Init method call inside the OnLaunched method around line 52:
// under this line
rootFrame.NavigationFailed += OnNavigationFailed;
// add this line
Xamarin.Forms.Forms.Init (e); // requires the `e` parameter
In the UWP project, edit MainPage.xaml by removing the Grid contained within the Page element. Then in MainPage.xaml, add a new xmlns entry for Xamarin.Forms.Platform.UWP, like this: xmlns:forms="using:Xamarin.Forms.Platform.UWP".
In MainPage.xaml, change the root <Page element to <forms:WindowsPage, like this:
<forms:WindowsPage
...
xmlns:forms="using:Xamarin.Forms.Platform.UWP"
...
</forms:WindowsPage>
In the UWP project, edit MainPage.xaml.cs to remove the: Page inheritance specifier for the class name (since it will now inherit from WindowsPage due to the change made in the previous step)
public sealed partial class MainPage // REMOVE ": Page"
In MainPage.xaml.cs, add the LoadApplication call in the MainPage constructor to start the Xamarin.Forms app:
// below this existing line
this.InitializeComponent();
// add this line
LoadApplication(new YOUR_NAMESPACE.App());
Add any local resources (eg. image files) from the existing platform projects that are required.
And now it should work as before. I know, it's a hassle to go through it for something that just worked before. Sorry about that, but this should get you there as well.
With the Update 16.0.1, Microsoft restored the UWP creation on new Xamarin.Forms applications
except when you try to use Shell, which is not available for UWP:
Issues fixed in Visual Studio 2019 version 16.0.1
Add option for Windows (UWP) platform when creating new Xamarin.Forms project from 'Mobile App (Xamarin.Forms)' project
template.
EDIT (7/17/2021): i have started a new xamarin forms solution and it seems all 3 platforms are available again in VS2019 on all prebuilt templates (blank, master-detail, tabbed layout).
thank you, everyone, for your input.
great information!
it helped me steel myself to face the fact:
UWP is gone (for now) from Xamarin.Forms new project scaffolding.
but, the (simplest) solution to the question asked that i have found is:
open VS2017. create new Xamarin.Forms cross-platform project.
once it is open, save-all.
then close VS2017 and open in VS2019 if so desired.

Qt Application crashes whenever WebKit tries to load HTML

I'm using Qt 4.7.4 with C++ and I'm trying to embed a html document with some flash elements into a Qt application. To start out I added a QWebView widget to my main window and tried to load a html document stored on my harddrive, that caused an error so I looked up the Qt examples and attempted to run the youtube viewer example here: http://qt-project.org/wiki/Embed_YouTube_Video_in_QWebView
Both times I got the same issue when attempting to run the program:
"The procedure entry point ??1QSslSocket##UAE#XY could not be located
in the dynamic link library QtWebkit4.dll"
I used dependency walker and it states that QSslSocket is in QNetwork4.dll which is in my release folder (and it's the release version). Also my QTDIR environment variable points to the correct location and the location of the bin folder is in my path variable.
So I was wondering if anyone here could help me out. I'm also using visual studio 2005 (unfortunately using Qt 4.7.4 and vs 2005 are out of my control in this instance)
You would need to check the following things:
Your Qt installation is built with SSL support.
You have the SSL dll correctly recognized.
You have the version required to avoid symbol mismatches.

How to get list of themes (Theme name) installed in Windows 7?

I want to write an application in MFC which gives me a list of theme installed in windows 7.
Which library or dll provide the themes so I can use it in my application to change the theme using my application or can I have code snippet ?
Regards,
Mehul.
Enumerate files under %WinDir%\Resources\Themes and %AppData%\Microsoft\Windows\Themes.
The format of .theme files is documented at http://msdn.microsoft.com/en-us/library/windows/desktop/bb773190(v=vs.85).aspx

c++ win32 changing the application display name

I've developed a win32 api application using c++. It was developed using visual studio 2010. When i started developing i gave it a codename and now when it's done i would like to change the applications name, but don't know where to change it (i'm quite new to win32 and visual studio).
I would like to change the .exe name and description (displayed in taskmanager), the name display in the notification area (now it shows MyCodeNameApplication.exe insted of MyCodeNameApplication).
I would also like to give a description, version and author name (so when installing it doesn't say unknown provider).
How can i change this things?
Edit the version resource in your .rc file.
change the path name in 'yourfilename'.dsp