Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GUID
Message
From
08/08/2001 08:54:40
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
08/08/2001 07:59:34
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Re: GUID
Miscellaneous
Thread ID:
00541165
Message ID:
00541198
Views:
24
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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform