各位大虾,如何将GUID或CLSID结构转换成这种形式?

PagiHi 2002-05-16 03:24:26
类似于这种的{C2ABC522-210E-4C79-92FF-50E03DD91D80}字符串,一定给分。
...全文
75 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fantong 2002-05-16
  • 打赏
  • 举报
回复
要注意
LPOLESTR lpsz
要大于40
好像是吧
jimconrad 2002-05-16
  • 打赏
  • 举报
回复
使用函数StringFromGUID2():

Converts a globally unique identifier (GUID) into a string of printable characters.

int StringFromGUID2(
REFGUID rguid, //GUID to be converted
LPOLESTR lpsz, //Pointer to resulting string
int cchMax //Size of array at lpsz
);
Parameters
rguid
[in] GUID to be converted.
lpsz
[out] Pointer to a caller-allocated string variable to contain the resulting string on return.
cchMax
[in] Number of characters available in the buffer indicated by lpsz.
Return Values
0 (zero)
Array at lpsz is too small to contain a string representation of a GUID.
Non-zero value
The number of characters in the returned string, including the null terminator.
Remarks
The string that the lpsz parameter receives has a format like that of the following sample:

{c200e360-38c5-11ce-ae62-08002b2b79ef}
where the successive fields break the GUID into the form DWORD-WORD-WORD-WORD-WORD.DWORD covering the 128-bit GUID. The string includes enclosing braces, which are an OLE convention.

Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in objbase.h.
Library: Use ole32.lib.

See Also
StringFromCLSID

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧