Introduction:-
Welcome to another tutorial of VB, in this tutorial I will tell you on how to delete a program permanently! how? simple just first we open the file replace it with and letter, number or symbol we want then delete it! So even if the file is brought back after deletion with any special software it will still be not accessible!
Solution:-
Well I will show you just the basics, because in my original program I made more but here I will just place the basic for newbies to understand better!
Ok so first we have to include the component of the CommonDialog here is how:-
and Select:-
Then Add a Command button
Add This Code:-
Code:
Sub Wipe(FileName As String)
On Error GoTo err
Dim Part1 As String
Dim hFileHandle As Integer, i As Long
Const SIZE = 1024
Part1 = String(SIZE, "#")
hFileHandle = FreeFile
Open FileName For Binary As hFileHandle
For i = 1 To hFileHandle
Put hFileHandle, , Part1
Next i
Close hFileHandle
Exit Sub
err:
Exit Sub
End Sub
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Wipe CommonDialog1.FileName
Kill CommonDialog1.FileName
MsgBox "File Deleted Safely", vbInformation, "WipeFile"
End Sub
Explanation:-
Code:
Sub Wipe(FileName As String)
This is the sub we will call to delete the file when pressing the command button
For a better explanation read this tutorial:-
Code:
Dim Part1 As String
Dim hFileHandle As Integer, i As Long
Const SIZE = 1024
Part1 = String(SIZE, "#")
hFileHandle = FreeFile
Here we are declaring some variables etc.. and assigning some things
the important thing here is the line
'Part1 = String(SIZE, "#")' the symbol
# means what you want to replace every bit with! you can change it to 0 or so! for example if you try this on an exe file and then open it with a HEX viewer all you see will be that symbol!
like this:-
Code:
Open FileName For Binary As hFileHandle
For i = 1 To hFileHandle
Put hFileHandle, , Part1
Next i
Close hFileHandle
Here we are opening the file as binary then we loop to replace everything with a # when everything is replaced we close the file!
Code:
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Wipe CommonDialog1.FileName
Kill CommonDialog1.FileName
MsgBox "File Deleted Safely", vbInformation, "WipeFile"
End Sub
When we press the command button the Open Dialog will be showed, then you choose a file to delete
"WARNING FILE WILL BE PERMANENTLY DELETED!!" and after that we call the Sub Wipe to replace it with the symbol after we kill the file ( delete ) and then it shows a msgbox saying that the file was deleted!
NOTE:- To see that this really works delete the line that says 'Kill CommonDialog1.FileName' then go to that file, open it with a hex editor and you will see that this really works!! all you will see is that symbol you specify!!
As i already showed you here is what you will see:-
Conclusion:-
As Always Feedback is welcome and the full source is attached!! NOTE:- The source code is a little modified and contains more functions! If you don't have VB installed and can't run the code but you need the program, just
request here and I will upload the EXE file for those without VB installed