diff options
Diffstat (limited to '')
-rw-r--r-- | CPP/Windows/COM.h | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/CPP/Windows/COM.h b/CPP/Windows/COM.h index cee7f70..a8780ca 100644 --- a/CPP/Windows/COM.h +++ b/CPP/Windows/COM.h | |||
@@ -1,9 +1,9 @@ | |||
1 | // Windows/COM.h | 1 | // Windows/COM.h |
2 | 2 | ||
3 | #ifndef __WINDOWS_COM_H | 3 | #ifndef ZIP7_INC_WINDOWS_COM_H |
4 | #define __WINDOWS_COM_H | 4 | #define ZIP7_INC_WINDOWS_COM_H |
5 | 5 | ||
6 | #include "../Common/MyString.h" | 6 | // #include "../Common/MyString.h" |
7 | 7 | ||
8 | namespace NWindows { | 8 | namespace NWindows { |
9 | namespace NCOM { | 9 | namespace NCOM { |
@@ -21,17 +21,18 @@ public: | |||
21 | // it's single thread. Do we need multithread? | 21 | // it's single thread. Do we need multithread? |
22 | CoInitialize(NULL); | 22 | CoInitialize(NULL); |
23 | #endif | 23 | #endif |
24 | }; | 24 | } |
25 | ~CComInitializer() { CoUninitialize(); } | 25 | ~CComInitializer() { CoUninitialize(); } |
26 | }; | 26 | }; |
27 | 27 | ||
28 | class CStgMedium | 28 | /* |
29 | class CStgMedium2 | ||
29 | { | 30 | { |
30 | STGMEDIUM _object; | 31 | STGMEDIUM _object; |
31 | public: | ||
32 | bool _mustBeReleased; | 32 | bool _mustBeReleased; |
33 | CStgMedium(): _mustBeReleased(false) {} | 33 | public: |
34 | ~CStgMedium() { Free(); } | 34 | CStgMedium2(): _mustBeReleased(false) {} |
35 | ~CStgMedium2() { Free(); } | ||
35 | void Free() | 36 | void Free() |
36 | { | 37 | { |
37 | if (_mustBeReleased) | 38 | if (_mustBeReleased) |
@@ -42,6 +43,21 @@ public: | |||
42 | STGMEDIUM* operator->() { return &_object;} | 43 | STGMEDIUM* operator->() { return &_object;} |
43 | STGMEDIUM* operator&() { return &_object; } | 44 | STGMEDIUM* operator&() { return &_object; } |
44 | }; | 45 | }; |
46 | */ | ||
47 | |||
48 | struct CStgMedium: public STGMEDIUM | ||
49 | { | ||
50 | CStgMedium() | ||
51 | { | ||
52 | tymed = TYMED_NULL; // 0 | ||
53 | hGlobal = NULL; | ||
54 | pUnkForRelease = NULL; | ||
55 | } | ||
56 | ~CStgMedium() | ||
57 | { | ||
58 | ReleaseStgMedium(this); | ||
59 | } | ||
60 | }; | ||
45 | 61 | ||
46 | #endif | 62 | #endif |
47 | 63 | ||