Creating a program that can lock your folders and unlock them again
1. Open Visual Studio or Visual Basic.
2. Create a new windows form project and name it whatever you want.
Now to add the controls.
1. Add 3 buttons set the text on them to "Lock" and the second button "Unlock". And on the last button you write "Browse".
2. Add 2 textboxes and clear them for text.
3. Add 2 labels, write in Label1 "Folder Destination" and put it above Textbox1, Write in Label2 "Folder Name".
4. Add a folderbrowser dialog
6. Add this code to the button that says "Lock".
Dim text1 as string = ".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}"
Shell("cmd /c" & "ren " & TextBox1.Text & " " & TextBox2.Text & Text1)
Shell("cmd /c" & "attrib +s +h " & TextBox1.Text & ".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}\*.*" & " /S /D")
Shell("cmd /c" & "attrib +s +h " & TextBox1.Text & ".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}" & " /S /D")
What this does is, it open shell and execute a command in command prompt that will first change the name of the folder and then hide it, it lock the folder and hide it completly, you will NOT be able to find the folder by going to folder options and select show hidden folders, so remember where the folder you lock is.
7. Add this code to the button that says "Unlock".
Dim text1 as string = ".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}"
Shell("cmd /c" & "attrib -s -h " & TextBox1.Text & ".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}" & " /S /D")
Shell("cmd /c" & "attrib -s -h " & TextBox1.Text & ".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}\*.*" & " /S /D")
System.Threading.Thread.Sleep(1000)
Shell("cmd /c" & "ren " & TextBox1.Text & Text1 & " " & TextBox2.Text)
What this does is it does the reversed of what the "Lock" button did it will unlock the folder.
8. Now the code for the button that says "Browse" add this code
FolderBrowserDialog1.ShowDialog() TextBox1.Text = FolderBrowserDialog1.SelectedPath last = Path.GetFileName(FolderBrowserDialog1.SelectedPath) TextBox2.Text = last TextBox1.Text = TextBox1.Text.Replace(".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}", "")
TextBox2.Text = TextBox2.Text.Replace(".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}", "")
What this does it it open the folderbrowser dialog and put the full path of the folder you selected into textbox1.text and put the name of the selected folder in textbox2.text.
When your done it should look kinda like mine, i have some added feautures which i will make a tutorial on later.
Please dont repost without giving credits to the right website, thank you
Written and coded by: AnoPem