Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cortana from Win32 [closed]

This is a rather directionless post I'm afraid an I apologize. I'm trying to figure out how to use Cortana from win32 (non universal) applications. I found this link but I can't tell if there is a way to access these APIs from non-managed code. That sent me on a rabbit trail to find out what this UniversalApiContract stuff is and how to use it form native code but so far I am coming up very empty.

Could someone please provide me with some direction!! What do I even need to search for to begin to learn how to access these APIs natively? Is there some reading on windows runtime that I should undertake?

Thanks in advance and again I apologize for the general questions - not sure where else to turn.

like image 800
Ben Avatar asked Sep 02 '25 17:09

Ben


1 Answers

[Expressed displeasure over how many people voted to close the thread without any useful response or suggestions]

Now, on to science. After spending some time with this it would seem this is not possible. I was able to call the API from Win32 by using the Visual C++ Component Extensions. This allows you to use windows runtime and CLR like concepts but results in purely native code. As a side note, since I wanted to link this with an application that I did not want to recompile with this extension, I did this in a DLL and delay loaded it.

Unfortunately the call to install the voice command definition file failed with a COMException: The process has no package identity. This means I can successfully call the API, however it requires a package identity - in other words, it must be called from a Modern/Store/Universal App context with an application identity.

The only way remaining to me seems to be to use the Cortana background API to interface with a modern app I write in the background, and use it to broker calls from my Win32 app to Cortana through some sort of custom communication. Icky.

I hope this helps save someone else time.

like image 143
Ben Avatar answered Sep 04 '25 05:09

Ben