The WRL sample is updated to support event handling on a WinRT component.
It requires a special delegate type in the IDL file.
#define COMPONENT_VERSION 1.0
delegate HRESULT LoggerEventHandler([in] HSTRING e);
interface ILogger : IInspectable
HRESULT LogInfo([in] HSTRING value);
[eventadd] HRESULT LoggerChanged([in] LoggerEventHandler* handler, [out][retval] EventRegistrationToken* token);
[eventremove] HRESULT LoggerChanged([in] EventRegistrationToken token);
[default] interface ILogger;
Sample updated : http://code.msdn.microsoft.com/windowsapps/Windows-Runtime-Component-4dc6fa20
The issue number 174 of Programmez magazine, available on May 1, will contain my technical article about WinRT, C++ and WRL.
Based on my first sample review (see previous post), I have updated my C++/WRL sample that implements Vector<T>, Map<K, V>, UnorderedMap<K, V>.
This file is the C++/WRL portage of the collection.h file that was designed for C++/CX.
Sample Link: http://code.msdn.microsoft.com/windowsapps/Windows-Runtime-Component-9b6c6989
My C++/WRL sample available in Dev Center – Windows Store Apps has been reviewed by the creator of WRL himself, Sridhar Madhugiri.
Because this sample source code will be the support for an upcoming technical article published in Dr Dobb’s magazine Digital Issue, I have asked the Microsoft Visual C++ Lead to give me some advices.
I had a strange bug in some circumstances. So he proposed directly to Sridhar to give me some help !
My problem was about handling HSTRING new Windows data type. It has to be wrapped with a String helper class.
The same issue occurred with interface pointers that need to be wrapped with the ComPtr<T> class.
Sample Link: http://code.msdn.microsoft.com/windowsapps/Windows-Runtime-Component-4dc6fa20
I have made a portage of collection.h available for C++/CX for handling collections like Vector<T>, Map<K, V>.
This header can be only used for C++/CX so… if you want to rely on standard ISO C++, you can download my header called NewCollection.h.
It’s available on Dev Center – Windows Store Apps : http://code.msdn.microsoft.com/windowsapps/Windows-Runtime-Component-9b6c6989
I have uploaded a Windows C++ sample to illustrate how to develop WinRT components using WRL and standard ISO C++. It demonstrates how to create async method and the usage to return a vector of string and a vector of int using a template based vector container implemented using std::vector.