CoCreateGuid()用法
(2009-12-15 20:49:32)
标签:
杂谈 |
分类: C |
今天在代码中看到下面一个函数:
CString CConnectManager::newGUID()
{
}
用来返回一个系统自动生成的32位字符串。
关于CoCreateGuid()函数,MSDN如下解释:
The GUID structure stores a GUID.
typedef struct _GUID {
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE Data4[8]; } GUID;
Members
- Data1
-
Specifies the first 8 hexadecimal digits of the GUID.
- Data2
-
Specifies the first group of 4 hexadecimal digits.
- Data3
-
Specifies the second group of 4 hexadecimal digits.
- Data4
-
Array of 8 bytes. The first 2 bytes contain the third group of 4 hexadecimal digits. The remaining 6 bytes contain the final 12 hexadecimal digits.
Remarks
GUIDs are the Microsoft implementation of the distributed computing environment (DCE) universally unique identifier ( UUID). The RPC run-time libraries use UUIDs to check for compatibility between clients and servers and to select among multiple implementations of an interface. The Windows access-control functions use GUIDs to identify the type of object that an object-specific ACE in an access-control list (ACL) protects.
函数用来返回一个唯一的表示字符串。