From 79b9ac4371ffc9feb055587a5824e49030deb06d Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 24 Apr 2017 21:07:39 +0200 Subject: [PATCH] winstd::com_obj "QueryInterface" constructors added --- include/WinStd/COM.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/WinStd/COM.h b/include/WinStd/COM.h index e221453d..4fd8d0f4 100644 --- a/include/WinStd/COM.h +++ b/include/WinStd/COM.h @@ -64,6 +64,32 @@ namespace winstd } + /// + /// Queries the object for another interface and creates new class with it + /// + /// \sa [IUnknown::QueryInterface method](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682521.aspx) + /// + template + inline com_obj(_Out_ _Other **other) + { + assert(other); + other->QueryInterface(__uuidof(T), (void**)&m_h); + } + + + /// + /// Queries the object for another interface and creates new class with it + /// + /// \sa [IUnknown::QueryInterface method](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682521.aspx) + /// + template + inline com_obj(_Out_ com_obj<_Other> &other) + { + assert(other); + other->QueryInterface(__uuidof(T), (void**)&m_h); + } + + /// /// Releases object ///