1 #ifndef __WINSTRUTILS_H__64B78566_C82A_438c_BA3E_50C763964D7B__
2 #define __WINSTRUTILS_H__64B78566_C82A_438c_BA3E_50C763964D7B__
12 #ifdef _INC_COMUTIL // if included Comutil.h
18 #endif // _INC_COMUTIL
20 #ifdef GUID_DEFINED // if included GuidDef.h
22 inline StrUtils_Return_Type ToString(
const GUID& guid)
25 #pragma warning(disable:4244) // Disable the nasty "LPVOID to Unsigned long" conversion warning
26 StrUtils_Return_Type strData1 = UnSignedNumber2Str(guid.Data1,
sizeof(guid.Data1) * 2, DEFAULT_FILLER, 16,
false);
27 StrUtils_Return_Type strData2 = UnSignedNumber2Str(guid.Data2,
sizeof(guid.Data2) * 2, DEFAULT_FILLER, 16,
false);
28 StrUtils_Return_Type strData3 = UnSignedNumber2Str(guid.Data3,
sizeof(guid.Data3) * 2, DEFAULT_FILLER, 16,
false);
29 StrUtils_Return_Type strData40 = UnSignedNumber2Str((
unsigned int)(guid.Data4[0]), 2, DEFAULT_FILLER, 16,
false);
30 StrUtils_Return_Type strData41 = UnSignedNumber2Str((
unsigned int)(guid.Data4[1]), 2, DEFAULT_FILLER, 16,
false);
31 StrUtils_Return_Type strData42 = UnSignedNumber2Str((
unsigned int)(guid.Data4[2]), 2, DEFAULT_FILLER, 16,
false);
32 StrUtils_Return_Type strData43 = UnSignedNumber2Str((
unsigned int)(guid.Data4[3]), 2, DEFAULT_FILLER, 16,
false);
33 StrUtils_Return_Type strData44 = UnSignedNumber2Str((
unsigned int)(guid.Data4[4]), 2, DEFAULT_FILLER, 16,
false);
34 StrUtils_Return_Type strData45 = UnSignedNumber2Str((
unsigned int)(guid.Data4[5]), 2, DEFAULT_FILLER, 16,
false);
35 StrUtils_Return_Type strData46 = UnSignedNumber2Str((
unsigned int)(guid.Data4[6]), 2, DEFAULT_FILLER, 16,
false);
36 StrUtils_Return_Type strData47 = UnSignedNumber2Str((
unsigned int)(guid.Data4[7]), 2, DEFAULT_FILLER, 16,
false);
37 return strData1 + _T(
"-") + strData2 + _T(
"-") + strData3 + _T(
"-") +
38 strData40 + strData41 + _T(
"-") + strData42 + strData43 + strData44 + strData45 + strData46 + strData47;
41 #endif // GUID_DEFINED
44 #ifdef _OBJBASE_H_ // if included ObjBase.h
46 inline StrUtils_Return_Type ToString(
const COMSD& comsd)
48 const TCHAR* strComSD[] = { _T(
"SD_LAUNCHPERMISSIONS"), _T(
"SD_ACCESSPERMISSIONS"), _T(
"SD_LAUNCHRESTRICTIONS"), _T(
"SD_ACCESSRESTRICTIONS")};
49 return strComSD[comsd];
53 #ifdef WINVER // if included Windows.h
55 #define DECLARE_HANDLE_TYPE_TO_STRING(name) \
57 inline StrUtils_Return_Type ToString(const name& _obj)\
59 return ToString((void*)_obj); \
62 DECLARE_HANDLE_TYPE_TO_STRING(HBITMAP)
63 DECLARE_HANDLE_TYPE_TO_STRING(HBRUSH)
64 DECLARE_HANDLE_TYPE_TO_STRING(HCOLORSPACE)
65 DECLARE_HANDLE_TYPE_TO_STRING(HDESK)
66 DECLARE_HANDLE_TYPE_TO_STRING(HENHMETAFILE)
68 DECLARE_HANDLE_TYPE_TO_STRING(HEVENT)
70 DECLARE_HANDLE_TYPE_TO_STRING(HFONT)
71 DECLARE_HANDLE_TYPE_TO_STRING(HGLRC)
72 DECLARE_HANDLE_TYPE_TO_STRING(HHOOK)
73 DECLARE_HANDLE_TYPE_TO_STRING(HICON)
74 DECLARE_HANDLE_TYPE_TO_STRING(HINSTANCE)
75 DECLARE_HANDLE_TYPE_TO_STRING(HKL)
76 DECLARE_HANDLE_TYPE_TO_STRING(HKEY)
77 DECLARE_HANDLE_TYPE_TO_STRING(HMENU)
78 DECLARE_HANDLE_TYPE_TO_STRING(HMETAFILE)
79 DECLARE_HANDLE_TYPE_TO_STRING(HMONITOR)
80 DECLARE_HANDLE_TYPE_TO_STRING(HRGN)
81 DECLARE_HANDLE_TYPE_TO_STRING(HRSRC)
82 DECLARE_HANDLE_TYPE_TO_STRING(HSPRITE)
83 DECLARE_HANDLE_TYPE_TO_STRING(HSTR)
84 DECLARE_HANDLE_TYPE_TO_STRING(HTASK)
85 DECLARE_HANDLE_TYPE_TO_STRING(HUMPD)
86 DECLARE_HANDLE_TYPE_TO_STRING(HWINSTA)
87 DECLARE_HANDLE_TYPE_TO_STRING(HWND)
90 inline StrUtils_Return_Type ToString<FARPROC>(const FARPROC& fProc)
92 return ToString((
void*)fProc);
123 inline StrUtils_Return_Type ToString(
const __int64& nNumber)
125 return SignedNumber2Str(nNumber);
129 inline StrUtils_Return_Type ToString(
const LARGE_INTEGER& liNumber)
131 return ToString(liNumber.QuadPart);
135 inline StrUtils_Return_Type ToString(
const POINT& Point)
137 return StrUtils_Return_Type(_T(
"{")) + ToString(Point.x) + _T(
",") + ToString(Point.y) + _T(
"}");
141 inline StrUtils_Return_Type ToString(
const RECT& rect)
143 return StrUtils_Return_Type(_T(
"{")) + ToString(rect.left) + _T(
",") + ToString(rect.top) + _T(
",") + ToString(rect.right) + _T(
",") + ToString(rect.bottom) + _T(
"}");;
147 inline StrUtils_Return_Type ToString(
const SIZE& Size)
149 return StrUtils_Return_Type(_T(
"{")) + ToString(Size.cx) + _T(
",") + ToString(Size.cy) + _T(
"}");
154 inline StrUtils_Return_Type ToString(
const ULARGE_INTEGER& uliNumber)
156 return ToString(uliNumber.QuadPart);
158 #endif // ifdef WINVER
160 #ifdef DIRECT3D_VERSION // if included DirectX headers
162 inline StrUtils_Return_Type ToString(
const D3DXVECTOR3& Vec)
164 return StrUtils_Return_Type(_T(
"{")) + ToString(Vec.x) + _T(
",") + ToString(Vec.y) + _T(
",") + ToString(Vec.z) + _T(
"}");
166 #endif // ifdef DIRECT3D_VERSION
168 #endif // __WINSTRUTILS_H__64B78566_C82A_438c_BA3E_50C763964D7B__