Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible for Win32 App calling an WinRT API?

Assuming that I am on Windows 8+ and I have a Win32/C App. Can my Win32 App call into WinRT API?

like image 547
Kenny Lim Avatar asked Sep 17 '14 00:09

Kenny Lim


1 Answers

Short answer - yes: How to: Activate and Use a Windows Runtime Component Using WRL

Long answer: Windows Runtime is heavily based upon COM technology. The Windows Runtime components are actually some kind of COM objects. So the common rules for instantiating and using COM objects apply to Windows Runtime components.

First, you must initialize the Windows Runtime environment. There's a useful class called RoInitializeWrapper you can use to do this. Then, you use an activation factory to obtain a pointer to the Windows Runtime component's interface. You work with the interface, and when you finished, you must uninitialize the Windows Runtime environment by destroying your RoInitializeWrapper.

like image 122
Alovchin Avatar answered Oct 06 '22 18:10

Alovchin