I wrote an application in VB6. While testing I want it to run only when a pen drive with specific VOLUME SERIAL NUMBER is attached. Can any body help me in finding out the volume serial number attached to the system.
Regards
I wrote an application in VB6. While testing I want it to run only when a pen drive with specific VOLUME SERIAL NUMBER is attached. Can any body help me in finding out the volume serial number attached to the system.
Regards
Found : Page load error
thanks
Then if your problem is solved, please mark you thread as solved and give any posts that were helpful to you a positive rating if you think that post deserves it...
Good Luck
Still not solved...
I tried it in Clipper & did it .
Then why not in VB...?
????????????????????????????????????????????????????
hi
Still not solved...
I tried it in Clipper & did it .Then why not in VB...?
????????????????????????????????????????????????????
hey santhosh
u just go and type the correct coding
You need to get serial no of a specific drive right?... Here..
Add this reference "Microsoft Scripting Runtime"
Then, to get Serial No of the drive, add this Function.
Public Function GetDriveSerial(xDrive as string) as string
Dim FSO As New FileSystemObject
If FSO.GetDrive(xDrive).IsReady = True then
GetDriveSerial = FSO.GetDrive(xDrive).SerialNumber
End if
End Function
xDrive = Drive letter.. ex. "C"
This will return the serial no of xDrive..
Hope this will help you.
One more thing, if you found a solution on how to lock pendrive by serial number, pm me or just post it where you found it. thanks.
Hi Jhai Salvador
Thanks for your coding...but I faced compile error as userdefine type not defined on the line ::: Dim FSO As New FileSystemObject
Pl reply me what reference or ocx is to add.. surely i will let you know the logic of locking the pen drive for the specific application.
You need to add a reference to the Microsoft Scripting Runtime...
Good Luck
Jhai Salvador AND VB5PRGRMR
THANKS JHAI : U R GOOD,GOODER,GOODEST, THE BEST, U SOLVED MY PROBLEM . I M SENDING YOU THE LOGIC TO TRAP A PENDRIVE VERY SOON.
ALSO A LOTS OF THANKS TO VB5PRGRMR FOR YOUR KIND CO-OPERATION & VALUABLE GUIDENCE
GOD BLESS U
Jhai Salvador AND VB5PRGRMR
Jhai ur solution Please check & let me know the bugs
--------------------------------------------------------------------------
Public Function GetDriveSerial() ' (xDrive As String) As String
Dim FSO As New FileSystemObject
Dim Flg As Boolean
Dim xDr As String
On Error GoTo SKIPIT
Flg = False
For Each dr In FSO.Drives
xDr = Left(dr, 1)
If FSO.GetDrive(xDr).IsReady = True Then
GetDriveSerial = FSO.GetDrive(xDr).SerialNumber
MsgBox GetDriveSerial ' Check details below...
If GetDriveSerial = "203462167" Then
Flg = True: Exit For
End If
End If
Next
If Flg = True Then
MsgBox "Welcome the world of santosh5471@rediffmail.com ..."
Else
MsgBox "LOCK NOT FOUND...!"
End If
SKIPIT:
Exit Function
End Function
'Notes
'MsgBox GetDriveSerial : will display the Sr.No. of every drive.
'I have hardcoded this number of my Pen Drive
'I have called this function from Form1.frm as
' Private Sub Form_Load()
' Dim PenSrNo As Variant
' PenSrNo = GetDriveSerial()
' End Sub
' As I call this function it checks all the drive letter A....Z
' or drives on ur HDD and displays proper message
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.