Papierkorb auslesen

The place for programming-related topics.
Laurin

Papierkorb auslesen

Post by Laurin »

Gut, dann stelle ich hier die Frage nochmals :)

Ich würde gerne den Inhalt des Windows Papierkorbs per IShellFolder auslesen.

Kann mir wer sagen, wie ich das anstellen soll? Ist vielleicht irgendwo ein Beispiel vorhanden oder die entsprechende TypeLib?

Freundliche Grüsse

Laurin

DAnke für die Hilfe im voraus!
[hr]
Translation for visitors not speaking German:
I'd like to readout the content of the recycle bin using IShellFolder.

Can anyone tell me how to do this? Maybe there's a sample or the required type library available somewhere?

Kind regards

Laurin

Thanks in advance!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Hi,

ich habe eine passende TypeLib und ein Beispielprojekt angehängt. Die TypeLib enthält sehr viele Interfaces, die für dieses Projekt überflüssig sind, deshalb habe ich den Quellcode mit dazugepackt.

HTH
TiKu
[hr]
Translation for visitors not speaking German:
Hi,

I've attached a suitable type library and a sample project. The TypeLib contains many interfaces that are not required in this project, so I've included the sourcecode.

HTH
TiKu
Attachments
ExplorerTreeView.zip
A type library containing most shell interfaces
(49.71 KiB) Downloaded 639 times
BitBucketReader.zip
A VB6 sample demonstrating how to read the recycler's content
(7.15 KiB) Downloaded 656 times
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Laurin

Post by Laurin »

Hi...

erstmal super danke!
Echt riesiiggg!!!
Scheint auch ganz gut zu funktionieren.

Nur noch eine kurze Frage. Ich habe am Anfang einfach nur die exe entpackt und ausgeführt. Das lief wunderbar, obwohl ich deine tlb nicht registiert habe. Gut ich dachte vielleicht liegts dran, dass ich dein explorer treeview drauf habe. Habe es also auf einem anderen Rechner versucht: Es lief wunderbar!
Anschliessend habe ich dein Projekt mal entpackt und in der IDE ausgeführt. Da wird dann deine Typelib verlangt.

Wieso läuft das in der exe und in der IDE nicht?
Ich wäre natürlich froh, wenn ich keine typelib bräuchte oder das nötige direkt eincompilen kann.

Weisst du weiter?

Danke im voraus und danke für die viele, grossartig geleistet hilfe

Laurin
[hr]
Translation for visitors not speaking German:
Hi...

at first let me thank you!
It's really greaaattt!!!
And it seems to work quite good.

Just one more short question. In the beginning I just extracted and executed the exe file. It ran marvelously, although I had not registered your tlb file. Well, I thought, maybe it's because I have installed your ExplorerTreeView. So I tried it on another system: It ran marvelously!
Then I extracted your project and executed it within the IDE. Now I'm asked for your type library.

Why is it working in the exe file, but not in the IDE?
Of course I'd be glad if I wouldn't need a type library or could compile it directly into the binary.

Do you know how to do this?

Thanks in advance and thanks for your big help.

Laurin
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Type Libraries werden automatisch mit in die Binary kompiliert und werden nur innerhalb der IDE benötigt.
[hr]
Translation for visitors not speaking German:
Type libraries are compiled into the binary automatically and are required for the IDE only.
Last edited by TiKu on 05 Sep 2005, 22:38, edited 1 time in total.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Laurin

Post by Laurin »

Hab tausend dank!
[hr]
Translation for visitors not speaking German:
Many thanks!
Laurin

Post by Laurin »

Noch ein kleiner Nachtrag:

Schade, auf allen Betriebsystemen vor Win 2000 funktioniert das ganze nicht. Ich erhalte den Fehler DLL - Einsprungspunkt nicht erhalten.
Kann man da wohl nichts machen?
Also unter Win 98 sollte es kein Problem sein, da der Ordner wirklich ein stinknormaler Ordner ist, aber unter Win ME ist er schon ein virtueller Namensbereich und dort funtzt nicht.

Mfg
laurin
[hr]
Translation for visitors not speaking German:
A small addition:

Too bad that the sample doesn't work on systems prior Windows 2000. I get the error "Entry point not found". You can't fix this, can you?
It's no problem on Windows 98, because the recycler is a real folder there, but on Windows ME it's already a virtual one and it doesn't work there.

Kind regards
laurin
Laurin

Post by Laurin »

Kann leider nicht editieren.

Aber sorry hatte einen kleinen Fehler:

Der DLL-Einsprungspunkt Fehler erscheint nur unter Win 98. Unter Win ME erhalte ich einfach nur ein "C" in der Textbox, pro File. D.h. es sind zb 5 Files drin:

C
C
C
C
C

Hm... irgendwie wird der string da falsch konvertiert, denn im debuggen kann ich einmal einen Pfad so knapp erkennen... weisst du weiter?

Mfg
laurin

danke schonmal :)
[hr]
Translation for visitors not speaking German:
I can't edit my post.

I'm sorry, there was a small mistake:

The entry point not found error appears on Windows 98 only. On Windows ME I just get a "C" in the edit box (for each file). I. e. there're 5 files:

C
C
C
C
C

Looks like the string conversion is wrong, because within the Debugger I can see the correct paths... can you help me?

Kind regards
laurin

Thanks in advance :)
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Win9x ist ein ANSI-System, das Beispiel war auf Unicode ausgelegt. Ich habe es jetzt nicht getestet, aber die angehängte Version sollte auch unter Windows 9x laufen.

Zu dem nicht gefundenen Einsprungpunkt: Wie im Quellcode vermerkt ist, benötigt SHGetFolderLocation() Windows Me/2000 und sollte deshalb durch SHGetSpecialFolderLocation() ersetzt werden, wenn der Code auch unter Windows 95/98/NT4 laufen soll.;)
[hr]
Translation for visitors not speaking German:
Win9x is an ANSI system, but the sample targeted Unicode systems. I didn't test it, but the attached version should work on Windows 9x, too.

Concerning the not found entry point: Like you can read in the source code, SHGetFolderLocation() requires Windows Me/2000 and should be replaced with SHGetSpecialFolderLocation() if the code must also run on Windows 95/98/NT4.;)
Attachments
BitBucketReader.zip
Updated sample to make it compatible with Windows 9x.
(7.22 KiB) Downloaded 657 times
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Laurin

Post by Laurin »

Hallo

Nochmals danke für die gute Hilfe.
Ich habe jetzt dein aufruf umgebogen auf folgendes:

Code: Select all

SHGetSpecialFolderLocation Me.hwnd, CSIDL_BITBUCKET, pIDLRecycleBin
Funktioniert gut. Das Sample gibt jetzt nach deiner Änderung auch den wirklichen Pfad aus. D.h. es funktioniert jetzt auf allen Systemen (98,ME,2000,XP).

Nevertheless, there's a little bug :'( ... Unter Win 98 zeigt er mir nicht den Pfad an, sondern lediglich den Namen der Dateien. Aber nicht mal den wirklichen Namen, sondern der ehemalige Filename.
Also ich habe drin z.B. eine Verknüpfung Internet Verbindung erstellen, dann zeigt er mir einfach den Namen an. Wie kann ich auch unter Win 98 noch den Pfad erhalten?

Danke schonmal :)

Mfg
Laurin
[hr]
Translation for visitors not speaking German:
Hello

again thanks for the great help.
I've changed your code to:

Code: Select all

SHGetSpecialFolderLocation Me.hwnd, CSIDL_BITBUCKET, pIDLRecycleBin
Works well. Also after your change, the sample gives me the real paths now. IOW, it's working on all systems now (98,ME,2000,XP).

Nevertheless, there's a little bug :'( ... On Win 98 I don't get the path, but the filename only - but not even the real (current) name, but the file's old name.
So, let's say there's a link "Internet Verbindung erstellen" - the sample will give me exactly this name. How can I get the real name on Win 98, too?

Thanks in advance :)

Kind regards
Laurin
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Hi,

ich habe mir jetzt mal Windows 98 SE installiert und das näher untersucht. In der Tat, es werden die alten Dateinamen angezeigt. Die IShellFolder::GetDisplayNameOf()-Implementation des Papierkorbs liefert unter Windows 98 leider unabhängig von den übergebenen SHGDN_*-Flags IMMER den alten Dateinamen. Deshalb wird man wohl zumindest unter Windows 98 auf FindFirstFile() zurückgreifen müssen.

Windows 95 verhält sich vermutlich auch so.

Timo
[hr]
Translation for visitors not speaking German:
Hi,

I've installed Windows 98 SE and taken a closer look on this. Indeed, I get the old filenames. Unfortunately the IShellFolder::GetDisplayNameOf() implementation of Windows 98's recycle bin ignores the passed SHGDN_* flags and ALWAYS returns the old filename. So, at least on Windows 98 you'll have to use FindFirstFile().

I guess it's the same with Windows 95.

Timo
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Laurin

Post by Laurin »

Hi

Wie stellst du dir das denn mit FindFirstFile vor? Einfach %HOMEDRIVE%\Recycler durchsuchen?

Stimmt, wäre eine möglichkeit. Nur bin ich mir unter Win 98 nicht sicher wie sich der Papierkorb bei mehreren Partitionen verhält!? Wird alles in den %HOMEDRIVE% Papierkorb gelöscht?
Wenn ich also auf D:\ etwas lösche, wird es dann in C:\Recylcer verschoben, wenn dort mein Win installiert ist?

Habe leider auf meinem Win 98 keine zwei Partitionen. Vielleicht weisst dus ja grad? Aber mach dir keine Umstände, hast schon genug geholfen :)

Ich depp habe gerade gemerkt, dass ich eigentlich direkt Englisch posten könnte, damit du nicht alles übersetzten musst. Sorry, werde das zukünftig tun.

mfg
laurin
[hr]
Translation for visitors not speaking German:
Hi

how do you imagine the FindFirstFile solution? Just search in %HOMEDRIVE%\Recycler?

Okay, this would be an alternative. But I'm not sure how Win 98's recycler is behaving if there're multiple partitions!? Is everything moved into the %HOMEDRIVE% recycler?
If I delete something on D:\, is it moved to C:\Recycler if my Windows is installed on C:\?

Unfortunately my Windows 98 system doesn't have multiple partitions. Maybe you know the behavior? But don't trouble, you've already helped me out a lot :)

Kind regards
laurin
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Meines Wissens hat auch unter Windows 98 jede Partition ihren eigenen Papierkorb; der Ordner heißt (sprachunabhängig) jeweils Recycled. Du müsstest also alle Laufwerke vom Typ Festplatte ermitteln (GetLogicalDriveStrings() + GetDriveType()) und dort jeweils den Ordner Recycled durchsuchen. Das sollte nicht so schwer sein.

Timo
[hr]
Translation for visitors not speaking German:
AFAIK on Windows 98 each partition has its own recycler; in each case the folder is named Recycled (independent from the language). So you would have to get all harddisk drives (GetLogicalDriveStrings() + GetDriveType()) and enumerate the content of each drive's recycler. This shouldn't be difficult.

Timo
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Laurin

Post by Laurin »

thx, i'll do it this way

kind regards

laurin
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

I've found out that you can use SHGetPathFromIDList on Windows 98. I've attached an updated sample.
Attachments
BitBucketReader.zip
Updated sample to make it work on Windows 95/98.
(6.1 KiB) Downloaded 663 times
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Laurin

Post by Laurin »

it works!!!!!! :)
I'm absolutely happy! BIG BIG THX you're really great!

thx for your qualified help.

this would be a great tipp for ActiveVb.de - what do you think about it?

kind regards with a biiiggg smillleee :mrgreen:

laurin
Post Reply