Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GUID
Message
De
08/08/2001 08:54:40
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
08/08/2001 07:59:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Re: GUID
Divers
Thread ID:
00541165
Message ID:
00541198
Vues:
22
Thanks, Cetin. If you don't mind, I will include the function (modified for the needs of PK generation: I only need a 16-byte value, not a visible representation thereof), and the incomplete credits.

One more question: do you know how Windows generates these GUIDs? I think the computer time has something to do, but I don't know for sure.

>Hilmar,
>I don't remember who to credit for this (not my code) :
>
*** Run this once at the beginning of your app (in your MAIN.PRG)
>
>DECLARE INTEGER CoCreateGuid ;
>  IN Ole32.dll ;
>  STRING @lcGUIDStruc
>DECLARE INTEGER StringFromGUID2 ;
>  IN Ole32.dll ;
>  STRING cGUIDStruc, ;
>  STRING @cGUID, ;
>  LONG nSize
>
>*** Run this as required.
>
>PROCEDURE GetGUID
>cStrucGUID=SPACE(16)
>cGUID=SPACE(80)
>nSize=40
>IF CoCreateGuid(@cStrucGUID) # 0
>   RETURN ""
>ENDIF
>IF StringFromGUID2(cStrucGUID,@cGuid,nSize) = 0
>  RETURN ""
>ENDIF
>RETURN STRCONV(LEFT(cGUID,76),6)
>ENDPROC
Cetin
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform