|
-
May 10th, 2007, 05:26 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] Restore File From Recycle Bin
Hello again!
In my program I need to be able to send them files to the recycle bin; then, there is also a need to be able to restore files from the recycle bin.
Sending to the recycle bin is covered with :
Code:
My.Computer.FileSystem.DeleteFile(SelFileName, FileIO.UIOption.AllDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.DoNothing)
How can I restore a deleted file from the recycle bin, if someone sent the wrong file to it?
-
May 10th, 2007, 05:32 AM
#2
Fanatic Member
Re: [2005] Restore File From Recycle Bin
I'm not sure that the restore option is available, but here is an alternative,
opent the recycle bin folder, cut and paste file back to it's original location.
-
May 10th, 2007, 05:34 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] Restore File From Recycle Bin
Hi, thanx for the advice, but I need to be able to do this from my program
-
May 10th, 2007, 05:57 AM
#4
Fanatic Member
Re: [2005] Restore File From Recycle Bin
within your program, when the restore button is click, u then navigate to the recycle bin and restore the selected file.
I don't vb right now so can't give you an example.
-
May 10th, 2007, 06:40 AM
#5
Thread Starter
Hyperactive Member
Re: [2005] Restore File From Recycle Bin
OK, I just shelled the Recycle Bin, meaning I opened it up from my program. Customers are happy with that 
This is how you sheel the RecycleBin from your application ( in case someone is interested) :
Code:
<DllImport("shell32.dll", EntryPoint:="ShellExecute", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function ShellExecute(ByVal hwnd As Int32, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Int32) As Int32
End Function
<DllImport("shell32.dll", EntryPoint:="GetDesktopWindow", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function GetDesktopWindow() As Int32
End Function
Private Const SW_SHOWMAXIMIZED As Long = 3
Private Const SW_SHOWDEFAULT As Long = 10
Private Sub RunShellExecute(ByVal sTopic As String, _
ByVal sFile As Object, _
ByVal sParams As Object, _
ByVal sDirectory As Object, _
ByVal nShowCmd As Long)
Dim hWndDesk As Long
Dim success As Long
'the desktop will be the
'default for error messages
hWndDesk = GetDesktopWindow()
'execute the passed operation
success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory, nShowCmd)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim sTopic As String
Dim sFile As String
Dim sParams As String
Dim sDirectory As String
'set default setting to be used
'if not specifically required
sTopic = "Open"
sDirectory = vbNullString
sFile = "explorer.exe"
'hkeylocalmachine\software\microsoft\windowsnt\currentversion\winlogon\shell
sParams = "/n,::{645FF040-5081-101B-9F08-00AA002F954E}"
RunShellExecute(sTopic, sFile, sParams, sDirectory, SW_SHOWDEFAULT)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|