Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP50 - Computer unique ID
Message
From
28/07/1998 14:34:25
John Baird
Coatesville, Pennsylvania, United States
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00119882
Message ID:
00122063
Views:
33
Right, but if the user reformats the drive, the volume no changes.

>>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
>
>Hi Morys,
>
>The following will get you the volume number:
>DECLARE SHORT GetVolumeInformation IN Win32API;
>  STRING @lpRootPathName, STRING @lpVolumeNameBuffer,;
>  INTEGER nVolumeNameSize, INTEGER @lpVolumeSerialNumber,;
>  INTEGER @lpMaximumComponentLength, INTEGER @lpFileSystemFlags,;
>  STRING @lpFileSystemNameBuffer, INTEGER nFileSystemNameSize
>lcrootpath = "C:\"
>STORE SPACE(260) TO lcvolumename, lcfilesystem
>STORE 260 TO lnvolumesize, lnsystemsize
>STORE 0 TO lnserialno, lnmaxlen, lnsysflags
>lnresult = GetVolumeInformation(@lcrootpath, @lcvolumename,;
>  lnvolumesize, @lnserialno, @lnmaxlen, lnsysflags,;
>  @lcfilesystem, lnsystemsize)
>If the function succeeds, lnresult will not equal zero.
>
>The value in the lnserialno variable is the volume's serial number. This corresponds directly to the value you see when you do a DIR from a DOS prompt. The difference is that the DOS prompt show the hexidecimal value of the number returned here.
>
>hth,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform