#include <sbAutoCOMInitializer.h>
Public Member Functions | |
sbAutoCOMInitializer (DWORD aInitFlags) | |
sbAutoCOMInitializer () | |
~sbAutoCOMInitializer () | |
HRESULT | Initialize (DWORD aInitFlags=COINIT_MULTITHREADED) |
void | Uninitialize () |
HRESULT | GetHRESULT () const |
bool | Succeeded () const |
bool | Initialized () const |
Public Attributes | |
int | mInitialized |
HRESULT | mFailureResult |
DWORD | mInitThreadId |
This class manages COM Initialization and uninitialization. You can use the constructor to initialize and destructor to uninitialize COM. Or you can use the Initialize and Uninitialize methods to manually manage. This class should be owned by a single thread and should never be called from multiple threads.
Definition at line 42 of file sbAutoCOMInitializer.h.
|
inline |
Initializes COM on construction
Definition at line 48 of file sbAutoCOMInitializer.h.
|
inline |
Initializes the object, but does not initialize COM. Iniialize must be called
Definition at line 57 of file sbAutoCOMInitializer.h.
|
inline |
Uninitializes COM on destruction of the object if COM has been initialized
Definition at line 66 of file sbAutoCOMInitializer.h.
|
inline |
Returns the HRESULT failure code that was returned from CoInitializeEx RPC_E_CHANGED_MODE is never returned as it's considered success.
Definition at line 142 of file sbAutoCOMInitializer.h.
|
inline |
Initializes COM. You may call this multiple times, it keeps track internally and only initializes COM on the first call. You MUST call Uninitialize for each extra call to Initialize in order for COM to be property uninitialized.
Definition at line 84 of file sbAutoCOMInitializer.h.
|
inline |
|
inline |
Determines whether initialization was successful. NOTE: Already initialized error where a different thread model was specified is considered success.
Definition at line 151 of file sbAutoCOMInitializer.h.
|
inline |
Called to uninitialize COM. Will uninitialze on the last call that matches the first call to Initialize.
Definition at line 119 of file sbAutoCOMInitializer.h.
HRESULT sbAutoCOMInitializer::mFailureResult |
The HRESULT that CoInitializeEx returned.
Definition at line 170 of file sbAutoCOMInitializer.h.
int sbAutoCOMInitializer::mInitialized |
Tracks whether and how many times the COM initialization has been requested.
Definition at line 165 of file sbAutoCOMInitializer.h.
DWORD sbAutoCOMInitializer::mInitThreadId |
The thread ID of the thread that called Initialize. Used to ensure we call CoUninitialize on the same thread.
Definition at line 176 of file sbAutoCOMInitializer.h.