Const AlterExtn = ".{f39a0dc0-9cc8-11d0-a599-00c04fd64433}" 'Class ID for Channel File
Public Nm, Pw As String
Dim FSO As New FileSystemObject
Dim MyDir
Private Sub cmdLk_Click()
On Error GoTo Err_Rep
If InStr(1, MyDir, ".", vbTextCompare) = 0 Then
frmL.Show vbModal, frmMain
If Nm <> "" And Pw <> "" Then
Open MyDir & "\Protect.dat" For Output As #1
Print #1, Nm
Print #1, Pw
Close #1
Name MyDir As MyDir & AlterExtn
Call MsgBox("The folder has been locked." & vbCrLf & vbCrLf & "You can Unlock it anytime by providing the same Name and PassWord.", vbInformation, "Folder Locked")
Clear
End If
Else
Call MsgBox("This folder is already Locked by other users.", vbExclamation, "Access Denied")
Call MsgBox("You are not authorised to Unlock this folder." & vbCrLf & vbCrLf & "This folder has been Locked by other users and can be Unlocked exclusively by the Owner user.", vbExclamation, "Unauthorised intrusion not allowed.")
Exit Sub
End If
Kill MyDir & "\Protect.dat"
Name MyDir As Mid(MyDir, 1, InStr(1, MyDir, ".", vbTextCompare) - 1)
Call MsgBox("The folder has been unlocked." & vbCrLf & vbCrLf & "You can now access it.", vbInformation, "Folder Unlocked")
Clear
End If
Else
Call MsgBox("This folder isn't Locked at all. You are free to access it.", vbExclamation, "Access Denied")
Call MsgBox("This Application has been designed by -" & vbCrLf & " Subarno Banerjee." & vbCrLf & "Inspired by the motivation of his friend, Subhasish Hazra." & vbCrLf & vbCrLf & "This application can be very useful in protecting personal or confidential files. Besides, it also helps those who have to share their resources like that in a cyber-cafe or school. You are free to use, comment on, suggest and modify this code.", vbInformation, "About")
End Sub
Private Sub mnuIns_Click()
Call MsgBox("Select the desired folder in the Directory List Box and click on the 'Lock' or 'Unlock' button to lock or unlock the folder as desired. Feed your User Name and Password correctly and your job is done. Folders protected by this application won't open in Windows Explorer unless you Unlock it.", vbInformation, "Instructions")