Solved

How to get the list of file names from recycled bin directory?

Posted on 1998-10-26
7
153 Views
Last Modified: 2010-04-06
Hi,

Does anyone knows how to get the list of file names from system recycled bin directory? If I use TFileList box, it's only giving the links to the deleted files but I would like to have the original file names.

Thanks in advance.
0
Comment
Question by:NYang
  • 3
  • 3
7 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1344442
You could use the IShellLink COM object to examine the links.

Regards, Madshi.
0
 

Author Comment

by:NYang
ID: 1344443
Madshi,  

Any possible for more detail about how to use this IShellLink COM?

Thanks.

NYang
0
 
LVL 1

Expert Comment

by:jecksom
ID: 1344444
Hi NyANG !

Madshi right , but you could also make structure (type) from 'Info.' hidden file in
recycled directory , first parameters (bytes) not really nessary for you , just get names
and then resolve them as Madshi said !

Jecksom


0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:NYang
ID: 1344445
Madshi, Jecksom,

I am sorry that I don't have any idea about Com Objects. Would you mind giving a small example?

Many many thanks.

Nyang
0
 
LVL 20

Accepted Solution

by:
Madshi earned 100 total points
ID: 1344446
Nyang,

here comes my "LoadShellLink" function. If you just want to know the name of the original file, call
"if LoadShellLink(linkFileName,@linkedObjStr,nil,nil,nil) then ..."

type TPString           = ^string;
var  NeedToUninitialize : boolean = false;

function LoadShellLink(shellLinkFile: string; linkedObj,params,workingDir,hotKey: TPString) : boolean;
var sl  : IShellLink;
    w1  : word;
    wfd : TWin32FindDataA;
begin
  NeedToUninitialize:=NeedToUninitialize or succeeded(CoInitialize(nil));
  sl:=CreateComObject(CLSID_ShellLink) as IShellLink;
  result:=(sl as IPersistFile).Load(PWideChar(wideString(ShellLinkFile)),0)=S_OK;
  if not result then exit;
  if linkedObj<>nil then begin
    SetLength(linkedObj^,MAX_PATH+1);
    if sl.GetPath(PChar(linkedObj^),MAX_PATH,wfd,0)=NOERROR then linkedObj^:=string(PChar(linkedObj^))
      else                                                         linkedObj^:='';
  end;
  if hotKey<>nil then begin
    sl.GetHotKey(w1);
    if w1 and (HOTKEYF_ALT     shl 8)<>0 then w1:=(w1 and (not (HOTKEYF_ALT     shl 8))) or scAlt;
    if w1 and (HOTKEYF_CONTROL shl 8)<>0 then w1:=(w1 and (not (HOTKEYF_CONTROL shl 8))) or scCtrl;
    if w1 and (HOTKEYF_SHIFT   shl 8)<>0 then w1:=(w1 and (not (HOTKEYF_SHIFT   shl 8))) or scShift;
    hotKey^:=ShortCutToText(w1);
  end;
  if params<>nil then begin
    SetLength(params^,MAX_PATH+1);
    if sl.GetArguments(PChar(params^),MAX_PATH)=NOERROR then params^:=string(PChar(params^))
    else                                                     params^:='';
  end;
  if workingDir<>nil then begin
    SetLength(workingDir^,MAX_PATH+1);
    if sl.GetWorkingDirectory(PChar(workingDir^),MAX_PATH)=NOERROR then workingDir^:=string(PChar(workingDir^))
      else                                                                workingDir^:='';
  end;
end;

initialization
  if NeedToUninitialize then CoUninitialize;
finalization
end.

Regards, Madshi.

P.S: You'll need at least Delphi 3...
0
 

Author Comment

by:NYang
ID: 1344447
Madshi,

You are very helpful, thank you so much.

NYang
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1344448
Just glad to have helped you...   :-)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now