GME
13
|
00001 #include "stdafx.h" 00002 #include "GUIDCreate.h" 00003 00004 /*static*/ const TCHAR * GuidCreate::format_str = _T("{%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}"); 00005 00006 CComBSTR GuidCreate::newGuid() 00007 { 00008 CString res; 00009 GUID t_guid = GUID_NULL; 00010 ::CoCreateGuid(&t_guid); 00011 00012 if (t_guid != GUID_NULL) 00013 { 00014 res.Format(format_str, 00015 t_guid.Data1, t_guid.Data2, t_guid.Data3, 00016 t_guid.Data4[0], t_guid.Data4[1], t_guid.Data4[2], t_guid.Data4[3], 00017 t_guid.Data4[4], t_guid.Data4[5], t_guid.Data4[6], t_guid.Data4[7]); 00018 } // else send blank 00019 00020 return CComBSTR(res); 00021 }