Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cComInit.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cComInit_H
7 #define _INC_cComInit_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
14 
15 #if defined(_WIN32)
16 
17 namespace GrayLib
18 {
19  UNITTEST2_PREDEF(cComInit);
20 
21  class GRAYLIB_LINK cComInit
22  {
28 
29  public:
30  static const DWORD k_UNK = 0xFFFF;
31  static const DWORD k_MULTITHREADED = 0;
32  static const DWORD k_APARTMENTTHREADED = 2;
33 
34  DWORD m_dwCoInit;
35  HRESULT m_hResCoInit;
36  static int sm_nInitCalls;
37 
38  private:
39  void Init2();
40 
41  public:
42  cComInit(DWORD dwCoInit = k_APARTMENTTHREADED); // use k_UNK = defer until later call to Init()
43  ~cComInit(void);
44 
45  bool isComInit() const
46  {
47  return SUCCEEDED(m_hResCoInit);
48  }
49 
50  HRESULT Init(DWORD dwCoInit = k_APARTMENTTHREADED);
51  void Exit();
52 
53  UNITTEST2_PREDEF(cComInit);
54  };
55 };
56 #endif
57 #endif
58 
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define SUCCEEDED(x)
Definition: HResult.h:29
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cMesh.h:22
UNITTEST2_PREDEF(cQuadtree)