Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP50 - Computer unique ID
Message
From
28/07/1998 11:28:11
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00119882
Message ID:
00121989
Views:
22
Rick,

I just tried your function but the ID I get every time I run it is
different all the time. What I am trying to get is a unique ID for
a computer. i.e. The serial number of a hard drive. Do you know how
can I get this? Any API functions maybe?

Thank you


>>Someone told me that there is a function in the UniversalThread to find a unique ID for a computer but I can't find it.
>>
>>Can someone give me a hint about how to do this or can someone tell me where that function is?
>>
>>Thank you
>
>This is probably overkill, but the following function creates a GUID that is guaranteed to be unique across time and computers.
>
>************************************************************************
>PROCEDURE CreateGUID
>********************
>*** Author: Rick Strahl, West Wind Technologies
>*** http://www.west-wind.com/
>*** Modified: 01/26/98
>*** Function: Creates a globally unique identifier using Win32
>*** COM services. The vlaue is guaranteed to be unique
>*** Format: {9F47F480-9641-11D1-A3D0-00600889F23B}
>*** Return: GUID as a string or "" if the function failed
>*************************************************************************
>
>DECLARE INTEGER CoCreateGuid ;
> IN Ole32.dll ;
> STRING @lcGUIDStruc
>
>DECLARE INTEGER StringFromGUID2 ;
> IN Ole32.dll ;
> STRING cGUIDStruc, ;
> STRING @cGUID, ;
> LONG nSize
>
>*** Simulate GUID strcuture with a string
>lcStruc_GUID = REPLICATE(" ",16)
>lcGUID = REPLICATE(" ",80)
>lnSize = LEN(lcGUID) / 2
>IF CoCreateGuid(@lcStruc_GUID) # 0
> RETURN ""
>ENDIF
>
>*** Now convert the structure to the GUID string
>IF StringFromGUID2(lcStruc_GUID,@lcGuid,lnSize) = 0
> RETURN ""
>ENDIF
>
>RETURN StrConv(LEFT(lcGUID,76),6)
>* CreateGUID
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform