?
Solved

"My Recent Documents" into a List

Posted on 2005-03-05
8
Medium Priority
?
362 Views
Last Modified: 2010-04-05
How do I get a list of all the files in the "My Recent Documents" Folder?  
Support for windows versions before Windows 2000 is not necessary.

I think that this question has two parts:

1) How do I find the correct folder where the file shorcuts (".lnk" files) are stored? I have noticed that this folder can be have various names, and the path to the folder depends on the logged in user's name.  So, how can my program know what the correct path is?

2) How do I get the original file path from the ".lnk" file?

Thank you,

Will.
0
Comment
Question by:wolsen
[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
  • 2
  • 2
  • +1
8 Comments
 
LVL 1

Expert Comment

by:din345
ID: 13467960
you can find the recent documents in the registry, in this key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs
0
 
LVL 1

Assisted Solution

by:din345
din345 earned 200 total points
ID: 13468076
here you can get the original path from the .lnk-file: http://delphi.about.com/od/windowsshellapi/l/aa072704a.htm
0
 
LVL 17

Accepted Solution

by:
mokule earned 200 total points
ID: 13468326
The folder You can get by

procedure TForm1.Button1Click(Sender: TObject);
var
  PIDL: PItemIDList;
  Path: array[0..MAX_PATH] of Char;
begin
  SHGetSpecialFolderLocation(Handle, CSIDL_RECENT, PIDL);
  SHGetPathFromIDList(PIDL, Path);
  Edit1.Text := StrPas(Path);
end;

mokule
0
Technology Partners: 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!

 
LVL 17

Expert Comment

by:mokule
ID: 13468559
You can place  TFileListBox on  a form and open such files like this

procedure TForm1.Button1Click(Sender: TObject);
var
  PIDL: PItemIDList;
  Path: array[0..MAX_PATH] of Char;
begin
  SHGetSpecialFolderLocation(Handle, CSIDL_RECENT, PIDL);
  SHGetPathFromIDList(PIDL, Path);
  Edit1.Text := StrPas(Path);
  FileListBox1.Directory := Edit1.Text;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ShellExecute(Handle,'open',PChar(FileListBox1.FileName),nil,nil,SW_SHOW);
end;

0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 13472612
For 1 :

If you install jvcl library from: http://jvcl.sourceforge.net then you can add a component called jvDirectories (jvSystem tab). This component will provide you with a list of many different directories including recent file lists. This list is adaptable and so it would appropriately change for different users

For 2:

Use din345 second post

Regards,

Hypoviax :: www.lhco.ws
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 13475268
Sorry for adding my website to by signature - please remove it
0
 

Expert Comment

by:_JHL_
ID: 13497260
mokule what lib I have to put iin Uses to run your prg..??

0
 
LVL 17

Expert Comment

by:mokule
ID: 13498234
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, shlobj, StdCtrls, shellapi, FileCtrl;

mokule
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 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