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".
7. Add this code to the button that says "Unlock".
8. Now the code for the button that says "Browse" add this code
Please dont repost without giving credits to the right website, thank you
Written and coded by: AnoPem
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
40 comments
nice tutorial , well explained
ReplyHey Dude:
ReplyHow can i download your Added feature Folder locker:
It has well look. More Function... and many more
Please Send it to me.
With the Project File:
And Can you Explain this: What is this?:
2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}\*.*" & " /S /D")
how this Folder Locker really lock or rename or something????
Does this works If i do this
ReplyGOTO : Tool -> Folder Option -> View
Then Clear,
Hide extension of known file type.
Hide protected operating system files.
Press Apply
Then Every Hidden System File Can be Seen.
Ok Dude,
ReplyPlease send me request on skype...
My skype name is: dm-product
and symbol is same as I have used as logo.
We will just talk about the new version.
Please send it soon,
So that we can talk about the newer version.
It should still hide it from that
ReplyWhat is the problem you get ?
Replyhttp://i41.tinypic.com/121fl8h.png here is the problem
ReplyDim last As String
ReplyFolderBrowserDialog1.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}", "")
Hi, AnoPem.
ReplyI translate it to C#, works beautiful.
Unfortunately the lockMode is easily bypassed with winRAR (Just compress folder and extract the files), and the hided file folder can be found with "dir /as"
But to me the important is the code, really thanks for share.
The problem is there need a space, add a space before "last = getfilename...."
ReplyGood luck
AnoPem.
Yes i know about the winrar bypass and im looking for a way to fix this, so if you have any sugguestions feel free to post them
ReplyAnoPem.
The problem is there need a space, add a space before "last = getfilename...." and before "textboxx1.text = "
ReplyGood luck
I have the same problem as Khawaja Ali.
ReplyI can't get it fixed by adding a space. Can you please re-post a fixed code for that part only? (Browse button)
I figured it out on my own. I changed the code a bit. :D
ReplyHeres how the code should look like for the lock button,
Replyhttp://pastebin.com/5ira80eZ
Lock button code fix, should look like this,
Replyhttp://pastebin.com/5ira80eZ
dude,
ReplyHow to add history option in this...
As I show the image I saw listbox/listview in it,
Can you give me the code for this.
And also explain how to add column and row in it
We decided to upload the source code for a newer version of this, this can be downloaded here. http://anopemp.com/folderlock.php
ReplyBut please be aware there may be alot of bugs in this version
The code of "Browse" Button should be like that:
Replyhttp://pastebin.com/Kw6n49K0
here is fixed errors in the browse button :
ReplyPrivate Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim last As String
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}", "")
End Sub
you just made some false spaces and you forgot to declare "last" as string :) , thnx for the share and good job !
and i forgot something , for the line:
Replylast = Path.GetFileName(FolderBrowserDialog1.SelectedPath)
you have to import this in the beginning of the code :)
Imports System.IO
how they add their name on the right click?
ReplyI mean whenever I click on Folder (right Click) then I get text that Lock folder with ...
How to do this?
Thank you
what is folderbrowserdialog it is making an error
Replyi cant make it yar help me
It can be easily bypassed by WinRAR.
ReplyFolderBrowserDialog is a dialog which lets you to view the folders on your computer or any data storage device attached. What kind of error do you get? I mean what is the error?
ReplyDude Please ... Am Getting A Lot Of Errors ...
ReplyI browse through a lot of websites in search of stuffs
so coming back here to read reply will be a problem
Please send me your project
kwabynalilwayne@gmail.com
Please put the code of Unlock Button in pastebin
Replyi want there is if you click the folder you lock the computer will shutdown
ReplyImports System.IO
ReplyPublic Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
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")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
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)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim last As String
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}", "")
End Sub
End Class
the folder is not hiding it is showing as it is
ReplyThen either you did something wrong or try update the folder
Replyi write every thing well... no error found....
Replyand still this not doing any thing to folder
waoooooooooo i got dis but my folder browse dialog is not showing
Replydo as i do
ReplyImports System.IO
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
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")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
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)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim last As String
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}", "")
End Sub
End Class
u need to upload the project source to us please
ReplyStupid nonsense
ReplyWhat a stupid code this is
Didn't work at all
The renaming to .{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} and then attribing is right and i agree but you cant make that number constant what if i want to lock 2 folders in the same directory? when it executes the renaming command it will result in an error because there is already something called .{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0} in the directory figure a way to make it completely random because if you want it to be good start with this kind of errors
ReplyVBasic Code Examples
ReplyYou motherfucker. Your code locked my Desktop and the fucking shit Unlocker code is also not unlcoking my desktop. Fcking asshole.
ReplyGood for you, you know how to bad mouth people. Theres nothing wrong with the codes and it should lock and unlock folders as described. But if someone actuly tries to lock their desktop? really? dont get mad at people for your own mistakes, lean from it instead.
ReplyPost a Comment
Note: Only a member of this blog may post a comment.