1 // Windows/COM.h
2 
3 #ifndef __WINDOWS_COM_H
4 #define __WINDOWS_COM_H
5 
6 #include "../Common/MyString.h"
7 
8 namespace NWindows {
9 namespace NCOM {
10 
11 #ifdef _WIN32
12 
13 class CComInitializer
14 {
15 public:
CComInitializer()16   CComInitializer()
17   {
18     #ifdef UNDER_CE
19     CoInitializeEx(NULL, COINIT_MULTITHREADED);
20     #else
21     // it's single thread. Do we need multithread?
22     CoInitialize(NULL);
23     #endif
24   };
~CComInitializer()25   ~CComInitializer() { CoUninitialize(); }
26 };
27 
28 class CStgMedium
29 {
30   STGMEDIUM _object;
31 public:
32   bool _mustBeReleased;
CStgMedium()33   CStgMedium(): _mustBeReleased(false) {}
~CStgMedium()34   ~CStgMedium() { Free(); }
Free()35   void Free()
36   {
37     if (_mustBeReleased)
38       ReleaseStgMedium(&_object);
39     _mustBeReleased = false;
40   }
41   const STGMEDIUM* operator->() const { return &_object;}
42   STGMEDIUM* operator->() { return &_object;}
43   STGMEDIUM* operator&() { return &_object; }
44 };
45 
46 #endif
47 
48 /*
49 //////////////////////////////////
50 // GUID <--> String Conversions
51 UString GUIDToStringW(REFGUID guid);
52 AString GUIDToStringA(REFGUID guid);
53 #ifdef UNICODE
54   #define GUIDToString GUIDToStringW
55 #else
56   #define GUIDToString GUIDToStringA
57 #endif
58 
59 HRESULT StringToGUIDW(const wchar_t *string, GUID &classID);
60 HRESULT StringToGUIDA(const char *string, GUID &classID);
61 #ifdef UNICODE
62   #define StringToGUID StringToGUIDW
63 #else
64   #define StringToGUID StringToGUIDA
65 #endif
66 */
67 
68 }}
69 
70 #endif
71