diff options
Diffstat (limited to 'CPP/Windows/COM.cpp')
| -rw-r--r-- | CPP/Windows/COM.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/CPP/Windows/COM.cpp b/CPP/Windows/COM.cpp new file mode 100644 index 0000000..d0cb321 --- /dev/null +++ b/CPP/Windows/COM.cpp | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | // Windows/COM.cpp | ||
| 2 | |||
| 3 | #include "StdAfx.h" | ||
| 4 | |||
| 5 | /* | ||
| 6 | |||
| 7 | #include "COM.h" | ||
| 8 | #include "../Common/StringConvert.h" | ||
| 9 | |||
| 10 | namespace NWindows { | ||
| 11 | namespace NCOM { | ||
| 12 | |||
| 13 | // CoInitialize (NULL); must be called! | ||
| 14 | |||
| 15 | UString GUIDToStringW(REFGUID guid) | ||
| 16 | { | ||
| 17 | UString s; | ||
| 18 | const unsigned kSize = 48; | ||
| 19 | StringFromGUID2(guid, s.GetBuf(kSize), kSize); | ||
| 20 | s.ReleaseBuf_CalcLen(kSize); | ||
| 21 | return s; | ||
| 22 | } | ||
| 23 | |||
| 24 | AString GUIDToStringA(REFGUID guid) | ||
| 25 | { | ||
| 26 | return UnicodeStringToMultiByte(GUIDToStringW(guid)); | ||
| 27 | } | ||
| 28 | |||
| 29 | HRESULT StringToGUIDW(const wchar_t *string, GUID &classID) | ||
| 30 | { | ||
| 31 | return CLSIDFromString((wchar_t *)string, &classID); | ||
| 32 | } | ||
| 33 | |||
| 34 | HRESULT StringToGUIDA(const char *string, GUID &classID) | ||
| 35 | { | ||
| 36 | return StringToGUIDW(MultiByteToUnicodeString(string), classID); | ||
| 37 | } | ||
| 38 | |||
| 39 | }} | ||
| 40 | |||
| 41 | */ | ||
