Using C++/CX in Desktop apps

Saturday, September 29, 2012

In my first and second post on using WinRT in a desktop app, we’ve used the raw API and then WRL to create and access WinRT objects. It would be easier to access WinRT using the new C++/CX extensions. Can we do that from a desktop app? Let’s give it a try.We’ll start with a regular Win32 Console application project. The first thing we need to do is to enable the C++/CX extensions. Open project properties and navigate to the C/C++ / General node and set “Consume Windows Runtime Extension” to Yes:Building the project now causes the compiler to...

Introduction to Windows Media Foundation

Monday, March 7, 2011

I’ve been writing a new course on this technology, so I thought I’d share some of my experiences with the Windows Media Foundation. What is Windows Media Foundation? The Windows Media Foundation is technically the successor of DirectShow (which is still around and very much supported), introduced in Windows Vista and enhanced in Windows 7. It’s a multimedia platform, capable of playing, analyzing, writing and otherwise transforming media (mostly video & audio, but can technically be anything). It’s based on similar principles as DirectShow, such as interface based programming using COM, which naturally lends...

.NET, COM and Apartments Tips

Thursday, February 21, 2008

We all know that when we use COM interop with .NET we get some RCW (Runtime Callable Wrapper) CLR object representing and controlling access to the underlying COM object. When we call the C# new operator, under the hood the RCW calls the CoCreateInstance API to create the actual COM object, etc. What may not be apparent, is that there may exist another proxy to the COM object, even if the COM server is a DLL (in-process server).The reason this may happen is related to COM apartments. an Apartment is a logical container of threads and COM objects that...