Recycle Bin 
Author Message
 Recycle Bin

RFJ

Quote:
> Is it possible to display the Recycle Bin Properties window?

In a nutshell...

  Call FolderProperties(CSIDL_BITBUCKET)

Public Function FolderProperties(nFolder As Long, _
                                                Optional hwndOwner As Long = 0) As Boolean
  Dim pidl As Long
  Dim sei As SHELLEXECUTEINFO

  ' Get the pointer to the folder's item ID list from
  ' it's specified folder ID, returns 0 on success
  If SHGetSpecialFolderLocation(hwndOwner, nFolder, pidl) = NOERROR Then
    If pidl Then
      sei.cbSize = Len(sei)
      sei.fMask = SEE_MASK_INVOKEIDLIST
      sei.lpVerb = "properties"
      sei.lpIDList = pidl
      FolderProperties = ShellExecuteEx(sei)
      ' Free the memory the shell allocated for the pidl
      Call CoTaskMemFree(pidl)
    End If
  End If

End Function

--
Brad Martinez
http://www.*-*-*.com/
http://www.*-*-*.com/

Please direct questions/replies to the newsgroup.



Fri, 12 Jan 2001 03:00:00 GMT  
 Recycle Bin
HI.

Is it possible to display the Recycle Bin Properties window?

Thanks.

RFJ



Sat, 13 Jan 2001 03:00:00 GMT  
 Recycle Bin
Hi Brad!

Thanks for your answer.

I found in your code a sub of Ole32.dll (CoTaskMemFree) and I have posted
questions in some groups asking for some material that gives me all or some
information about this dll.
Do you have some information that you can share with me, if possible?

It will be very appreciated.

Rinaldo Ferreira Junior



Sat, 13 Jan 2001 03:00:00 GMT  
 Recycle Bin
What is the Declaration for CSIDL_BITBUCKET?   Not found in API Viewer!

Quote:

>RFJ

>> Is it possible to display the Recycle Bin Properties window?

>In a nutshell...

>  Call FolderProperties(CSIDL_BITBUCKET)

>Public Function FolderProperties(nFolder As Long, _
>                                                Optional hwndOwner As Long
= 0) As Boolean
>  Dim pidl As Long
>  Dim sei As SHELLEXECUTEINFO

>  ' Get the pointer to the folder's item ID list from
>  ' it's specified folder ID, returns 0 on success
>  If SHGetSpecialFolderLocation(hwndOwner, nFolder, pidl) = NOERROR Then
>    If pidl Then
>      sei.cbSize = Len(sei)
>      sei.fMask = SEE_MASK_INVOKEIDLIST
>      sei.lpVerb = "properties"
>      sei.lpIDList = pidl
>      FolderProperties = ShellExecuteEx(sei)
>      ' Free the memory the shell allocated for the pidl
>      Call CoTaskMemFree(pidl)
>    End If
>  End If

>End Function

>--
>Brad Martinez
>http://members.aol.com/btmtz/vb
>http://www.mvps.org/ccrp

>Please direct questions/replies to the newsgroup.



Sun, 14 Jan 2001 03:00:00 GMT  
 Recycle Bin
Quote:

>What is the Declaration for CSIDL_BITBUCKET?   Not found in API Viewer!

10

The list I have is:
    CSIDL_DESKTOP = 0
    CSIDL_INTERNET = 1
    CSIDL_PROGRAMS = 2
    CSIDL_CONTROLS = 3
    CSIDL_PRINTERS = 4
    CSIDL_PERSONAL = 5
    CSIDL_FAVORITES = 6
    CSIDL_STARTUP = 7
    CSIDL_RECENT = 8
    CSIDL_SENDTO = 9
    CSIDL_BITBUCKET = 10
    CSIDL_STARTMENU = 11
    CSIDL_DESKTOPDIRECTORY = 16
    CSIDL_DRIVES = 17
    CSIDL_NETWORK = 18
    CSIDL_NETHOOD = 19
    CSIDL_FONTS = 20
    CSIDL_TEMPLATES = 21
    CSIDL_COMMON_STARTMENU = 22
    CSIDL_COMMON_PROGRAMS = 23
    CSIDL_COMMON_STARTUP = 24
    CSIDL_COMMON_DESKTOPDIRECTORY = 25
    CSIDL_APPDATA = 26
    CSIDL_PRINTHOOD = 27
    CSIDL_ALTSTARTUP = 29
    CSIDL_COMMON_ALTSTARTUP = 30
    CSIDL_COMMON_FAVORITES = 31
    CSIDL_INTERNET_CACHE = 32
    CSIDL_COOKIES = 33
    CSIDL_HISTORY = 34



Sun, 14 Jan 2001 03:00:00 GMT  
 Recycle Bin

RFJ

Hey sorry, blew right by your post here...

Quote:
> Thanks for your answer.

Sure...

Quote:
> I found in your code a sub of Ole32.dll (CoTaskMemFree) and I have posted
> questions in some groups asking for some material that gives me all or some
> information about this dll.
> Do you have some information that you can share with me, if possible?

Umm... Essentially CoTaskMemFree is used to free memory
the shell allocated for pidl (pointers to item ID lists) copies it
gives you. Technically speaking the IMalloc interface's Free
member should be used to free this memory instead, but since
I have found that both implementing the IMalloc interface can be
a bit more involved than most care to get, and that CoTaskMemFree
works fine, I opted for the easier solution. Here's the declare...

Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As Long)

For more info on memory allocation and CoTaskMemFree see...

http://premium.microsoft.com/msdn/library/sdkdoc/com_04aa.htm

For a little more involved discussion on pidls and the like see...

http://www.mvps.org/ccrp/resource/faqs/faqbrowse.htm

--
Brad Martinez
http://members.aol.com/btmtz/vb
http://www.mvps.org/ccrp

Please direct questions/replies to the newsgroup.



Sun, 14 Jan 2001 03:00:00 GMT  
 Recycle Bin
Ok after finally finding everything that goes with this all over the net, I
get an error now.

Error goes as follows:
"This File does not have a program associated with it for performing this
action.  Create an association in My Computer by clicking View and then
clicking Folder Options"

I'm on NT 4 workstation SP3  with IE4   Any suggestions?



Mon, 15 Jan 2001 03:00:00 GMT  
 Recycle Bin
So others don't have to redo what I just went through:

Private Const CSIDL_DESKTOP = 0
Private Const CSIDL_INTERNET = 1
Private Const CSIDL_PROGRAMS = 2
Private Const CSIDL_CONTROLS = 3
Private Const CSIDL_PRINTERS = 4
Private Const CSIDL_PERSONAL = 5
Private Const CSIDL_FAVORITES = 6
Private Const CSIDL_STARTUP = 7
Private Const CSIDL_RECENT = 8
Private Const CSIDL_SENDTO = 9
Private Const CSIDL_BITBUCKET = 10
Private Const CSIDL_STARTMENU = 11
Private Const CSIDL_DESKTOPDIRECTORY = 16
Private Const CSIDL_DRIVES = 17
Private Const CSIDL_NETWORK = 18
Private Const CSIDL_NETHOOD = 19
Private Const CSIDL_FONTS = 20
Private Const CSIDL_TEMPLATES = 21
Private Const CSIDL_COMMON_STARTMENU = 22
Private Const CSIDL_COMMON_PROGRAMS = 23
Private Const CSIDL_COMMON_STARTUP = 24
Private Const CSIDL_COMMON_DESKTOPDIRECTORY = 25
Private Const CSIDL_APPDATA = 26
Private Const CSIDL_PRINTHOOD = 27
Private Const CSIDL_ALTSTARTUP = 29
Private Const CSIDL_COMMON_ALTSTARTUP = 30
Private Const CSIDL_COMMON_FAVORITES = 31
Private Const CSIDL_INTERNET_CACHE = 32
Private Const CSIDL_COOKIES = 33
Private Const CSIDL_HISTORY = 34

Private Type SHELLEXECUTEINFO
        cbSize As Long
        fMask As Long
        hwnd As Long
        lpVerb As String
        lpFile As String
        lpParameters As String
        lpDirectory As String
        nShow As Long
        hInstApp As Long
        '  Optional fields
        lpIDList As Long
        lpClass As String
        hkeyClass As Long
        dwHotKey As Long
        hIcon As Long
        hProcess As Long
End Type

Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal
hWndOwner As Long, ByVal SHFolder As Long, idl As Long) As Long
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function ShellExecuteEX Lib "shell32.dll" Alias
"ShellExecuteEx" (SEI As SHELLEXECUTEINFO) As Long

Public Function FolderProperties(nFolder As Long, Optional hWndOwner As Long
= 0) As Boolean
  Dim pidl As Long
  Dim SEI As SHELLEXECUTEINFO

  ' Get the pointer to the folder's item ID list from
  ' it's specified folder ID, returns 0 on success
  If SHGetSpecialFolderLocation(hWndOwner, nFolder, pidl) = NOERROR Then
    If pidl Then
      SEI.cbSize = Len(SEI)
      SEI.fMask = SEE_MASK_INVOKEIDLIST
      SEI.lpVerb = "properties"
      SEI.lpIDList = pidl
      FolderProperties = ShellExecuteEX(SEI)
      ' Free the memory the shell allocated for the pidl
      Call CoTaskMemFree(pidl)
    End If
  End If

End Function

Private Sub Command1_Click()
    Call FolderProperties(CSIDL_BITBUCKET)
End Sub



Mon, 15 Jan 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Deleting documents with vba and the recycle bin.

2. Recycle Bin - Accessing

3. Sending Files to Recycle Bin

4. Sending Files to Recycle Bin

5. Recycle Bin API's (solved)

6. Recycle Bin

7. Repost: Recycle Bin

8. Deleting the Recycle Bin

9. How to delete using the Recycle bin in vb5

10. Drop your Tab Control in the Recycle Bin

11. Best way to empty Recycle bin using VB ?

12. Kill to recycle Bin

 

 
Powered by phpBB® Forum Software