Solved

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

Posted on 1998-10-26
7
160 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 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