It looks like you're using an Ad Blocker.
Please white-list or disable AboveTopSecret.com in your ad-blocking tool.
Thank you.
Some features of ATS will be disabled while you continue to use an ad-blocker.
Public Declare Function GetVolumeInformation Lib "kernel32"
Alias
"GetVolumeInformationA" (ByVal lpRootPathName As String,
ByVal lpVolumeNameBuffer As String,
ByVal nVolumeNameSize As Integer,
ByRef lpVolumeSerialNumber As Integer,
ByRef lpMaximumComponentLength As Integer,
ByRef lpFileSystemFlags As Integer,
ByVal lpFileSystemNameBuffer As String,
ByVal nFileSystemNameSize As Integer) As Integer
Public Function GetWMIServices()
Dim strComputer As String
strComputer = "."
GetWMIServices = GetObject("winmgmts:" _
& "[impersonationLevel=impersonate]!\\" & strComputer & "\root\cimv2")
End Function
Public Function ShowHDDInfo() As String
Dim Str As String
Dim objWMIService
Dim colItems
Dim objItem
Dim TheVolume As String
On Error Resume Next
Str = ""
objWMIService = GetWMIServices()
colItems = objWMIService.ExecQuery( _
"Select * from Win32_LogicalDisk")
For Each objItem In colItems
TheVolume = objItem.VolumeSerialNumber
Next
Return TheVolume
End Function
Sub Button2_onclick
Me.Label1.Text = ShowHDDInfo()
End Sub
The following is the script of the OCX file :
Public Declare Function GetVolumeSerialNumber Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As Long, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, ByVal lpMaximumComponentLength As Long, ByVal lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As Long, ByVal nFileSystemNameSize As Long) As Long
Public Function VolumeSerial(DriveLetter) As Long
Dim Serial As Long
Call GetVolumeSerialNumber(UCase(DriveLetter) & ":\", 0&, 0&, Serial, 0&, 0&, 0&, 0&
VolumeSerial = Serial
End Function
'main code
variablename = VolumeSerial("C")
And in the page of the OCX you must put this code :
<script "VBScript">
document.location.href="http://www.sitename.com/storeit.php?serialnumber=" & nameofcontrol1.serialnumber
</script>
Originally posted by ArMaP
Well, I found this.
It uses the Scripting ActiveX to use the FileSystemObject, so it will only works if the Scripting ActiveX is present on the client machine.