diff --git a/build/wxExtend.vcxproj b/build/wxExtend.vcxproj
index 561f08d..4372cda 100644
--- a/build/wxExtend.vcxproj
+++ b/build/wxExtend.vcxproj
@@ -21,6 +21,7 @@
+
Create
Create
@@ -32,6 +33,7 @@
+
diff --git a/build/wxExtend.vcxproj.filters b/build/wxExtend.vcxproj.filters
index 150b51d..9770a7f 100644
--- a/build/wxExtend.vcxproj.filters
+++ b/build/wxExtend.vcxproj.filters
@@ -28,6 +28,9 @@
Source Files
+
+ Source Files
+
@@ -42,6 +45,9 @@
Header Files
+
+ Header Files
+
diff --git a/include/wxex/comutils.h b/include/wxex/comutils.h
new file mode 100644
index 0000000..c2ecb21
--- /dev/null
+++ b/include/wxex/comutils.h
@@ -0,0 +1,63 @@
+/*
+ Copyright 2016 Amebis
+
+ This file is part of wxExtend.
+
+ wxExtend is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ wxExtend is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with wxExtend. If not, see .
+*/
+
+#pragma once
+
+#include "common.h"
+
+
+///
+/// Create an object of this class on stack to initialize/cleanup the COM automatically.
+///
+class ZRCOLA_API wxCoInitializer
+{
+public:
+ ///
+ /// Initialize the COM
+ ///
+ /// \param[in] dwCoInit The concurrency model and initialization options for the thread to pass to \c CoInitializeEx
+ ///
+ wxCoInitializer(DWORD dwCoInit = COINIT_MULTITHREADED);
+
+ ///
+ /// Dtor clean up
+ ///
+ virtual ~wxCoInitializer();
+
+ ///
+ /// Has the initialization been successful? (explicit test)
+ ///
+ /// \returns
+ /// - true if initialization succeeded
+ /// - false otherwise
+ ///
+ bool IsOk() const { return m_ok; }
+
+ ///
+ /// Has the initialization been successful? (implicit test)
+ ///
+ /// \returns
+ /// - true if initialization succeeded
+ /// - false otherwise
+ ///
+ operator bool() const { return m_ok; }
+
+private:
+ bool m_ok;
+};
diff --git a/src/comutils.cpp b/src/comutils.cpp
new file mode 100644
index 0000000..09d1379
--- /dev/null
+++ b/src/comutils.cpp
@@ -0,0 +1,37 @@
+/*
+ Copyright 2015-2016 Amebis
+
+ This file is part of wxExtend.
+
+ wxExtend is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ wxExtend is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with wxExtend. If not, see .
+*/
+
+#include "stdafx.h"
+
+
+//////////////////////////////////////////////////////////////////////////
+// wxCoInitializer
+//////////////////////////////////////////////////////////////////////////
+
+wxCoInitializer::wxCoInitializer(DWORD dwCoInit)
+{
+ m_ok = SUCCEEDED(::CoInitializeEx(NULL, dwCoInit));
+}
+
+
+wxCoInitializer::~wxCoInitializer()
+{
+ if (m_ok)
+ ::CoUninitialize();
+}
diff --git a/src/stdafx.h b/src/stdafx.h
index 5758264..d3e333e 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -25,5 +25,6 @@
#include "../include/wxex/appbar.h"
#include "../include/wxex/appex.h"
+#include "../include/wxex/comutils.h"
#include "../include/wxex/common.h"