//获取guid需要的头文件 //#include <atlstr.h> //#pragma comment(lib, "Rpcrt4.lib") class CGUID { public: //获取GUID static CString GetGUID() { GUID guid; HRESULT hr = CoCreateGuid(&guid); CString strGUID; strGUID.Format(_T("%08X-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X"), //无大括号 guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); return strGUID; } };