Private Declare Function GetVolumeInformation _
Lib "kernel32.dll" Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) _
As Long
Dim SerialNum As Long
Res = GetVolumeInformation("c:\", Temp1, Len(Temp1), SerialNum, 0, 0, Temp2,
Len(Temp2))
(david)
"Mota" <tavas...@hotmail.com> wrote in message
news:uiM9H5Vm...@TK2MSFTNGP12.phx.gbl...
"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:uhkkKGWm...@TK2MSFTNGP12.phx.gbl...
"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:uhkkKGWm...@TK2MSFTNGP12.phx.gbl...
>
>
"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:uhkkKGWm...@TK2MSFTNGP12.phx.gbl...
>
>
Yes.
> I put API in a Standard Module and replaced the word "Private" with
> "Public",and put the following code in a Click Event of a command button
> of a form:
> Dim SerialNum as long
dim Temp1 as string
dim Temp2 as string
Temp1 = space(250)
Temp2 = space(250)
> Res = GetVolumeInformation("c:\", Temp1, Len(Temp1), SerialNum, 0, 0,
> Temp2, Len(Temp2))
if res = 0 then
> MsgBox SerialNum
else
msgbox "Response:" & vbtab & res
endif
> but i got zero in MsgBox.What is wrong here?Can you help me please?
> In addition,I need a constant serial Number,e.g. a hard drive.Is the
> Volume Serial No countable enough to be used in a Locking system of a
> program?Does not it change after formating or partitioning a Hard Drive?
Yes, but all copy protection systems are faulty in one way or another.
Microsoft.public.access.formscoding is a good place to ask about
coding Access forms. I used this API as part of an Audit Record,
and, 7 years ago, as part of a home-grown text based replication
system, and I've passed it on to you for your consideration, but
I leave the question "how to write a good copy protection system"
(david)
"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:eus9Zz6m...@TK2MSFTNGP12.phx.gbl...
If all the requested information is retrieved, the return value is nonzero.
If not all the requested information is retrieved, the return value is 0
(zero). To get extended error information, call GetLastError.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getvolumeinformation.asp
I see that WMI returns the manufacturers serial number: that wasn't so
easily available when I was using the volume serical number. You can get
WMI information from a WMI object or probably from an OLEDB provider through
ADO
(david)
"Mota" <tavas...@hotmail.com> wrote in message
news:uuiLB77m...@TK2MSFTNGP10.phx.gbl...
>It works on my copy of Windows XP.
On mine, too.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
"John Nurick" <j.mapSo...@dial.pipex.com> wrote in message
news:iurdf11dn8iri070a...@4ax.com...