C++ how load the .NET runtime and thereby host WPF components - c++

The Visual Studio devenv.exe executable is a native program. However, native programs can load the .NET runtime and thereby host Windows Forms and WPF components.
I want to do as Visual Studio How to do it?

This blog post from Microsoft and its associated tutorial demonstrate how to use the new CLR hosting API's to host the CLR within your native apps.
This article also illustrates how to use the new CLR4 hosting API's.
As OP requested: Here's the first article of a series exploring how to host the CLR & WPF in a native app.
Also, here's an article about how to host a WPF control within an VC++/MFC app.

Related

Windows Store App - remove fullTrustCapability

I'm developing a C++-Win32-app which should be deployed in the Microsoft Store. Unfortunately, since runFullTrustis added automatically as required capability, the program appears in Microsoft Store as follows: "This app can access all your files, peripheral devices, apps, programs and registry.", but I don't need all of those capabilities. Is there any possibility to get rid of the runFullTrust capability or to choose which capabilities are really needed?
If you want to publish the Win32 apps in Microsoft Store, and you must add restricted capability runFullTrust in the manifest.
Only UWP app can be published in the Microsoft Store,if you have an existing desktop application that was built using the .NET Framework (including WPF and Windows Forms) or C++ Win32 APIs, you can several options(Package your desktop application in an MSIX package, Use UWP APIs...) for moving to the UWP and Windows 10. The moved app called desktop bridge apps. You can see more details in document:
Move from a desktop application to UWP
The restricted capability runFullTrust is required for any desktop application that is delivered as an appx or msix package (as with the Desktop Bridge), and it will automatically appear in your manifest when packaging these apps using the Desktop App Converter (DAC) or Visual Studio. You can see this in document:
Restricted capabilities

How can I call an UWP API from a C++ desktop application

I would like to access Bluetooth LE devices using the corresponding UWP APIs. However, my application is a "classic" C++ application (3D game) that can't run as a UWP app. Is there a way to do that? Accorind to enter link description here these APIs are published, but I don't know the steps to access them I have only found some posts for Windows 8/8.1 apps that include the Windows.winmd and Platform.winmd metadata files and set the /ZW compilation flag, but this doesn't seem to apply to Windows 10.
You should be able to do this, as the Bluetooth classes (e.g., BluetoothLEAdvertisement) are marked up with DualApiPartitionAttribute (callable from desktop and UWP apps).
Using one of the older Win8.1 desktop samples should give you a good starting point for calling the APIs without requiring /ZW or referencing the winmd files. A good example is the desktop toast API sample.
If you go that route, you can use classic COM to create the UWP/WinRT classes via WRL helpers.
You can use the web that you make a web server and the C++ application use the same server and if UWP send the info to server then it will send the info to C++ application.
To safe,the UWP can't use the desktop app.

Run c++ windows form in chrome native client

I have a simple c++ windows form in visual studio 2010. I want to know if is possible to have this form working with chrome native client PNaCl.
No, Native Client plugins work on the Web Platform, which is inherently platform independent. That means no Windows, OS/X or other platform APIs are exposed.
You must either port your app to use HTML / CSS / Javascript + Native Client, or use Native Messaging to allow your web app to communicate with a Native App that contains your Windows Form.
https://developer.chrome.com/extensions/nativeMessaging

Develop web service with using MFC (without .net framework)

Can I develop a web service in VC++ with MFC and without using of .net framework?
I wrote several classes in VC++ and used CRecordSet, CString, CArray and some of the other MFC classes. I want to use my classes in a new project (web service). Then I cann't change all classes to use standard library.
I think , I should write web service in VC++ , without .Net framework (Unmanaged code). Is it correct? Is a simple Sample of web service in VC++ by Unmanaged code?
No there is no simple way to create a web service with unmanaged code only. The easiest way would be to just write a web service using C#.
Than just use a C++/CLI wrapper to access your MFC code.
This isn't a real problem.
Your MFC code should be capable run inside a standard DLL. There should be no UI core at all in it. And remember that a Web Service has no state!

Services on windows using Visual C++ 6.0

I need to create a service on windows using Visual C++ 6.0 .
I am not familier with services so I read in the msdn site.
Can someone send me likns to agood sites explaining (with example) how to create service using Visual C++ 6.0 (prefer with examples) ?
You can use ATL to build a service in VC6. Try the ATL wizard, and let it generate the service stub for you, then you can flesh it out with proper functionality.
That said, the ATL framework's service support isn't great (at least wasn't in VC6), and will give you a service that's tailored to exposing COM objects.
There's a great book on services, called Professional NT Services:
http://www.amazon.com/Professional-NT-Services-Kevin-Miller/dp/1861001304/ref=pd_sim_b_3
See if you can get it used.