I want to make use of the member functions of the "Launcher class" Launcher class from a console C++ application, NOT a windows store app ( instead in a console application EXE).
Unlike any general WIndows API which includes a DLL, a header file as a minimum requirement, it includes a namespace Windows::System and a meta data "Windows.winmd".
So it means it uses .NET framework (Common language runtime) for this the Launcher class in thenamesapce WIndows.System.
I changed the VS settings in Properties -> Configuration -> COmmon Language runtime suspport to include CLR.
and I'm using :
using namespace System;
But I see Launcher class isn't present here. Also i tried
using namespace Windows.System;
as Launcher class is in WIndows.System namespace but couldn't find Launcher class here too.
Can I please ask for a help with a code snippet for using Launcher class member functions.
I didn't think this could be done initially, but it does appear to be possible.
Sridhar Poduri put together a Visual Studio extension that creates a C++/CX Console application project template. https://visualstudiogallery.msdn.microsoft.com/e9210454-c1b5-4d89-b8ca-92a64dfb8d28 A project built from this template will be capable of calling into C++/CX APIs such as Windows::System::Launcher::LaunchURIAsync(). However I'm not sure if this particular API can be used from a command line application, when I tried it it raised an exception.
If you want to know how to change a normal Win32 Console Application template to use C++/CX change the following in your project settings. Under C/C++->General
Under C/C++->Code Generation
Making these changes should allow you to compile code that uses C++/CX APIs. Here is some sample code:
#include <iostream>
using namespace std;
using namespace Platform;
int main(Platform::Array<Platform::String^>^ args)
{
Platform::Details::Console::WriteLine("Hello World");
return 0;
}
Also, I just wanted to point out that the Launcher API you are referencing is definitely not C++\CLI. It is C++\CX which shares similar syntax to C++\CLI.