View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Gehres Gehres is offline
external usenet poster
 
Posts: 2
Default A unique ID for protection?

Hi,
this thread is just what I was looking for -- much thanks to all !
Having said that, I am going to show my ignorance.
I program in Visual Studio .NET VB for a while now & have not come accross
a part of your example :

strVolName As String * cMaxPath

VB gives me an error on the "* cMaxPath" expects end ot statment.

Not sure what this syntax means - Thanks Again


----- Frank Kabel wrote: -----

Hi
you may use the HD drive ID for this. The following code gets this
number:

Declare Function GetVolumeInformation Lib "kernel32" Alias _
"GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal _
lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) As Long

Function get_drive_serial()
Const cMaxPath = 256, cDrive = "C:\"
Dim lngtemp
Dim strTemp As String, lngRet As Long
Dim lngVolSerial As Long, strVolName As String * cMaxPath
Dim lngMaxCompLen As Long, lngFileSysFlags As Long
Dim strFileSysName As String * cMaxPath

lngRet = GetVolumeInformation(cDrive, strVolName, cMaxPath, _
lngTemp, lngMaxCompLen, lngFileSysFlags, strFileSysName, _
cMaxPath)
strTemp = Format(Hex(lngTemp), "00000000")
strTemp = Left(strTemp, 4) & "-" & Right(strTemp, 4)

get_drive_serial = strTemp
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany


Hello, ..Hope you all enjoyed the jollies
Does anybody know a routine to get an unique ID from each computer. I

would like to use it for preventative copying.
Thanks for looking

CAA
---

Message posted from http://www.ExcelForum.com/