473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Empty Recycle bin - VB.NET code

Hi All

Can Anybody Please help me in how to Empty a Recycle bin using VB.NET code ?

Regards
Vighneswar
Jul 7 '06 #1
2 10013
Hello vighnesh,
Hi All

Can Anybody Please help me in how to Empty a Recycle bin using VB.NET
code ?
I believe that you need to P/Invoke for this functionality. Good news is
that there is a sample up on Pinvoke.net to do this very thing.

http://www.pinvoke.net/default.aspx/...ecycleBin.html
--
Jared Parsons [MSFT]
ja******@online.microsoft.com
All opinions are my own. All content is provided "AS IS" with no warranties,
and confers no rights.
Jul 7 '06 #2
This is how you do it:

Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias
"SHEmptyRecycleBinA" (ByVal hWnd As Int32, ByVal pszRootPath As String,
ByVal dwFlags As Int32) As Int32
Private Declare Function SHUpdateRecycleBinIcon Lib "shell32.dll" () As
Int32

Private Const SHERB_NOCONFIRMATION = &H1
Private Const SHERB_NOPROGRESSUI = &H2
Private Const SHERB_NOSOUND = &H4

#Region "Empty Recycle Bin (SUB)"

Private Sub EmptyRecycleBin()
SHEmptyRecycleBin(Me.Handle.ToInt32, vbNullString, SHERB_NOCONFIRMATION +
SHERB_NOSOUND)
SHUpdateRecycleBinIcon()
End Sub

#End Region

I hope this helps,

Crouchie1998
MCP MCSE
"vighnesh" <vi******@nannacomputers.comwrote in message
news:en**************@TK2MSFTNGP05.phx.gbl...
Hi All

Can Anybody Please help me in how to Empty a Recycle bin using VB.NET code
?
>
Regards
Vighneswar


Jul 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Thomas Halwax | last post by:
Hi, I wrote some code using the shell32.dll to query the size of the recycle bin. The function does not produce an error but the results are not correct: public struct SHQUERYRBINFO {...
7
by: Clinton Pierce | last post by:
I'm calling a method in another assembly that's supposed to return a string, and possibly that string might be empty. The code looks something like this: string d = r.Field("date").ToString();...
4
by: KenFehling | last post by:
Hello. I am wondering if there exists a piece of software that takes multiple .js files that are nicely indented and commented and create one big tightly packed .js file. I'm hoping the one file...
3
by: laredotornado | last post by:
Hi, Wondered if there was a good one-liner for what I want to do in PHP 4. I have an array, with an arbitrary number of elements. I'd like to know if all the elements in the array are empty. ...
12
by: Cmtk Software | last post by:
I'm trying to define an enum which will be used from unmanaged c++, C++/CLI managed c++ and from C#. I defined the following enum in a VS dll project set to be compiled with the /clr switch: ...
3
by: sudhaMurugesan | last post by:
Hi all, In my web page, why the read only text box's value becomes empty in the code behind file. I use ASP.net .I calculate the difference of two dates in js and display it in a readonly text...
1
by: Boris | last post by:
Hello I'm using debian linux, Python 2.4.4, and utidylib (http:// utidylib.berlios.de/). I wrote simple functions to get a web page, convert it from windows-1251 to utf8 and then I'd like to...
7
by: veer | last post by:
Hi i have a mdb table in which i want to access the data from mdb table into new table i,e Operator but the condition is if the data in first row of column say "operator_code" is "alfred" . The name...
2
by: =?Utf-8?B?VVNBT3o=?= | last post by:
I am using Windows Vista Ultimate (x86). I accidently deleted my Desktop Recycle Bin. I restored it (Control Panel/Personalise/Change Desktop Icons). I clicked on the Recycle Bin (Full) icon...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.