Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GUID code
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01007105
Message ID:
01007114
Vues:
15
There's no difference between them because the second one internaly uses the first one. However the second one may not be present on a computer if it doesn'r have WSH installed.

>I found these 2 examples of GUID code on FoxWiki.
>
>Which of the 2 would be more reliable?
>
>
>PROCEDURE guid
>	LOCAL lcPK,lcBuffer,i,lnHex,lnUpper,lnLower
>	DECLARE INTEGER CoCreateGuid IN OLE32.DLL STRING @lcBuffer
>	lcBuffer=SPACE(17)
>	lcPK=SPACE(0)
>	IF CoCreateGuid(@lcBuffer) = 0
>		FOR i=1 TO 16
>			lnHex=ASC(SUBSTR(lcBuffer,i,1))
>			lnUpper=INT(lnHex/16)
>			lnLower=lnHex-(lnUpper*16)
>			lcPK=lcPK+SUBSTR('0123456789ABCDEF',lnUpper+1,1)+;
>				SUBSTR('0123456789ABCDEF',lnLower+1,1)
>		ENDFOR
>	ENDIF
>	RETURN lcPK
>	ENDPROC
>
>FUNCTION guid2
>
>IF VAL(LEFT(VERSION(4), 2)) > 6
>	oGUID = CreateObject("scriptlet.typelib")
>	cGUID = Strextract(oGUID.GUID, "{", "}" )
>ELSE
>	** "VFP 6"
>	oGUID = CreateObject("scriptlet.typelib")
>	cGUID = substr( oGUID.GUID, 2, 36 )
>ENDIF
>
>RETURN cGUID
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform