Monthly Archives: May 2014

#BringOurNativeCompilersBack

#BringOurNativeCompilersBack

Dr Dobb’s June 2014

Dr. Dobb’s has published my technical article on the main page of the June 2014 Digital Issue.

This is a special Dr. Dobb’s Tech Digest with two special-interest articles. The first discusses using C++ and COM with WinRT, particularly in the context of the world of Windows Store Apps. The second article is an overview of using the Microsoft C++ REST SDK while in Visual Studio, which enables you to stay in C++ when consuming REST services

DrDobbs_June2014.pdf

WRL component with support for Event handlers

The WRL sample is updated to support event handling on a WinRT component.

It requires a special delegate type in the IDL file.

// Library1.IDL
import "inspectable.idl";
import "Windows.Foundation.idl";

#define COMPONENT_VERSION 1.0

namespace Library1
{
    interface ILogger;
    runtimeclass Logger;

    [uuid(1FCD374B-2C3C-49E3-93A7-6FB801080D45), version(COMPONENT_VERSION)]
    delegate HRESULT LoggerEventHandler([in] HSTRING e);

    [uuid(3EC4B4D6-14A6-4D0D-BB96-31DA25224A15), version(COMPONENT_VERSION)]
    interface ILogger : IInspectable
    {
        HRESULT LogInfo([in] HSTRING value);
        [eventadd] HRESULT LoggerChanged([in] LoggerEventHandler* handler, [out][retval] EventRegistrationToken* token);
        [eventremove] HRESULT LoggerChanged([in] EventRegistrationToken token);
    }

    [version(COMPONENT_VERSION), activatable(COMPONENT_VERSION)]
    runtimeclass Logger
    {
        [default] interface ILogger;
    }
}

Sample updated : http://code.msdn.microsoft.com/windowsapps/Windows-Runtime-Component-4dc6fa20