typedef GUID
begin
long Data1;
short Data2;
short Data3;
char c1;
char c2;
char c3;
char c4;
char c5;
char c6;
char c7;
char c8;
end;
prototype rpcrt4.UuidCreateSequential(pointer);
function OnFirstUIBefore()
number nResult;
string szTitle, szMsg;
string szLicenseFile, szQuestion;
string szDir;
GUID uid;
string strGUID;
string strTmp;
char ca;
begin
// TO DO: if you want to enable background, window title, and caption bar title
// SetTitle( @TITLE_MAIN, 24, WHITE );
// SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION );
// Enable( FULLWINDOWMODE );
// Enable( BACKGROUND );
// SetColor( BACKGROUND, RGB( 0, 128, 128 ) );
UuidCreateSequential( &uid );
Sprintf( strTmp, "%02lx", uid.c3 );
strGUID = strGUID + strTmp;
Sprintf( strTmp, "%02lx", uid.c4 );
strGUID = strGUID + strTmp;
Sprintf( strTmp, "%02lx", uid.c5 );
strGUID = strGUID + strTmp;
Sprintf( strTmp, "%02lx", uid.c6 );
strGUID = strGUID + strTmp;
Sprintf( strTmp, "%02lx", uid.c7 );
strGUID = strGUID + strTmp;
Sprintf( strTmp, "%02lx", uid.c8 );
strGUID = strGUID + strTmp;
SprintfBox( MB_OKCANCEL, "haha", "%s", strGUID );
…
end;
本文介绍了一种使用C/C++语言生成GUID并将其转换为字符串的方法。通过调用UuidCreateSequential函数创建GUID,并利用Sprintf函数将GUID的组成部分转换为十六进制字符串形式。文章还展示了如何将各部分字符串拼接成完整的GUID字符串。

3902

被折叠的 条评论
为什么被折叠?



