11-16-2007, 05:05 PM
|
#9
|
|
N00B Pwner
Last Online: 10-07-2009 10:14 PM
Join Date: Apr 2007
Location: In a House
Posts: 453
Rep Power: 3 Rep Points: 10
Points: 7,615.51
Bank: 38,432.60
Total Points: 46,048.11
|
Re: Mega Post of Tuts
Serial Protection
You will need::
1 Textbox
1 Command Button
-----------------------------
(this is to get the serial)
Add this coding to Command1
Code:
Private Sub Command1_Click()
Dim serial As String
serial = VolumeSerialNumber("C:\")
Text1.Text = serial
End Sub
Code:
Private Sub Form_Load()
Dim serial As String
serial = VolumeSerialNumber("C:\")
If serial = "0000-0000" Then 'use the serial finder and then put the serial you get here or it will not open
Form1.Show
Else
MsgBox "Sorry but you do not have permission to open this program"
End
End If
End Sub
Add this module to both the serial finder and prog u want protected::
Code:
Public Function VolumeSerialNumber(ByVal RootPath As String) As String
Public Declare Function GetVolumeSerialNumber 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
Dim VolLabel As String
Dim VolSize As Long
Dim serial As Long
Dim MaxLen As Long
Dim Flags As Long
Dim Name As String
Dim NameSize As Long
Dim s As String
If GetVolumeSerialNumber(RootPath, VolLabel, VolSize, serial, MaxLen, Flags, Name, NameSize) Then
s = Format(Hex(serial), "00000000")
VolumeSerialNumber = Left(s, 4) + "-" + Right(s, 4)
Else
VolumeSerialNumber = "0000-0000"
End if
End Function
Now after you have added the module to serial finder run it and push the
command , now your serial should be in the text box, copy it and replace
0000-0000 in the form load and now it should work.
Last edited by Derkel; 11-16-2007 at 05:18 PM.
|
|
|