MCPcopy Create free account
hub / github.com/Norbyte/ositools / CComScopedInit

Class CComScopedInit

OsiLoader/Utils.cpp:167–188  ·  view source on GitHub ↗

Helper class for exception-safe scope-based CoInitialize/CoUninitialize calls.

Source from the content-addressed store, hash-verified

165// CoInitialize/CoUninitialize calls.
166//
167class CComScopedInit
168{
169public:
170
171 CComScopedInit()
172 {
173 HRESULT hr = ::CoInitialize(NULL);
174 if (FAILED(hr))
175 AtlThrow(hr);
176 }
177
178 ~CComScopedInit()
179 {
180 ::CoUninitialize();
181 }
182
183
184 // Ban copy
185private:
186 CComScopedInit(const CComScopedInit&);
187 CComScopedInit& operator=(const CComScopedInit&);
188};
189
190
191//

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected