Solved

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

Posted on 1998-10-26
7
154 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

912 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

16 Experts available now in Live!

Get 1:1 Help Now