Solved

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

Posted on 1998-10-26
7
155 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
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.

 

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

813 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

18 Experts available now in Live!

Get 1:1 Help Now