Generate GUID

From The CA Plex Wiki

Jump to: navigation, search

Contents

Generate GUID

You may find that you require a globally unique identifier. The following C++ source code will generate one for you in a readable string format:

Source Code Object

{
	GUID myGuid;
	GUID* pmyGuid = &myGuid;
	HRESULT hRes = CoCreateGuid(pmyGuid);
	if(hRes == S_OK) {
		wchar_t buf[40];
		memset((void*)(wchar_t*)buf,0,40);
		StringFromGUID2(myGuid,(LPOLESTR)buf,40);
		&(1:).PutText(bstr_t(buf));
	}
}

Parameters

Notes

Example result: {c200e360-38c5-11ce-ae62-08002b2b79ef}

External Links

Personal tools