Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Uniqueness of SYS(2015)
Message
De
27/06/2007 22:30:47
 
 
À
27/06/2007 21:52:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01235219
Message ID:
01236180
Vues:
15
> >Does this require Windows Scripting Host?
> Yes.

This doesn't:
function GenerateGUID()
	declare integer CoCreateGuid in ole32.dll string @guid

	declare integer StringFromGUID2 in ole32.dll ;
		string @cCLSID, string @cUnicodeString, integer nLen
		
	local sGUIDBuffer, sTextBuffer, sGUID, nLength
	sGUIDBuffer = replicate(chr(0),16)	&& 128 bit buffer
	if CoCreateGuid( @sGUIDBuffer) != 0
		return null && error
	endif
	sTextBuffer = replicate(chr(0),80) && 39 unicode chars + null terminator
	nLength = StringFromGUID2( @sGUIDBuffer, @sTextBuffer, 40 )

	if m.nLength = 0
		return null  && error, probably buffer too small
	endif

	sGUID = strconv( left( m.sTextBuffer, nLength*2-1),10)
	return sGUID
endfunc
The result is an up-to-39 character string of the form like {093A8107-E749-456E-9379-B2CCE2793694}

If you want another format, sGUIDBuffer is the raw binary form.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform